1 Load data

### Load packages, functions and paths
source(file = "../01_install.R")
source(file = "../02_functions.R")
source(file = "../03_paths.R")

# MAF-like file
maf_data <- "41467_2017_1460_MOESM6_ESM_somatic_mutations.xlsx"
maf_path <- file.path(data_path, 
                      maf_data)
# Sup1 data
sup1_response_path <- file.path(results_pc_path, 
                           "sup1_response.csv")

### Define variables
nonsyn_categories <- c("Missense_Mutation", "Nonsense_Mutation", "Nonstop_Mutation", "Start_Codon_SNP", "Splice_Site")

### Read data & wrangle
## Read maf-like file
maf_df <- read_excel(maf_path,
                        skip=1,
                        col_names=TRUE)

# Add a sample ID column
maf_df <- maf_df %>%
  dplyr::mutate(sample_id = sub("_[12]$", "", tumor_name)) %>% 
  dplyr::rename(entrez_id = Entrez_Gene_Id,
                hugo_symbol = Hugo_Symbol) %>%
  dplyr::mutate(hugo_symbol = replace(hugo_symbol, hugo_symbol == "Unknown", NA),
                entrez_id = replace(entrez_id, entrez_id == 0, NA)) %>% 
  dplyr::select(sample_id, entrez_id, hugo_symbol, everything()) %>% 
  dplyr::arrange(sample_id) %>% 
  dplyr::distinct() %>% # Drops 2 rows that were duplicated in the original dataset
  dplyr::filter(!is.na(hugo_symbol) | !is.na(entrez_id)) # Drop where both Entrez, Hugo have NAs

# Convert Hugo Symbols to official naming
## Step 1: Filter out rows with NA in hugo_symbol
hugo_symbols <- maf_df %>% 
  dplyr::filter(!is.na(hugo_symbol)) %>% 
  dplyr::pull(hugo_symbol) %>% 
  as.character()

## Step 2: Convert to official name
ofc_hugo_symbols <- alias2SymbolTable(hugo_symbols, species = "Hs")

## Step 3: Add the ofc_hugo_symbols to the dataframe
maf_df$update_indicator <- !is.na(maf_df$hugo_symbol) & maf_df$hugo_symbol %in% hugo_symbols # Create an temp indicator for rows to update
maf_df <- maf_df %>%
  dplyr::mutate(hugo_symbol = ifelse(update_indicator, ofc_hugo_symbols[match(hugo_symbol, hugo_symbols)], hugo_symbol)) %>%
  dplyr::select(-update_indicator) %>% # Remove the indicator column after updating
  dplyr::filter(!is.na(hugo_symbol) | !is.na(entrez_id)) # Drop where both Entrez, Hugo have NAs (again)

## Read sup1_response.csv
sup1_response_df <- read.csv(sup1_response_path)[ , -1] # Drop first column

# Create a list of Responders and Non-responders
sample_id_lists <- split(sup1_response_df$Sample.ID, 
                         sup1_response_df$Patient.Response) # Split the "Sample.ID" values into lists based on "Patient.Response"

r_sample_ids <- sample_id_lists$R
nr_sample_ids <- sample_id_lists$NR

2 Initial considerations

# Filter rows where entrez_id is 0
missing_entrez_df <- maf_df %>%
  dplyr::filter(is.na(entrez_id))

# Filter rows where Hugo_Symbol is Unknown
missing_hugo_df <- maf_df %>%
  dplyr::filter(is.na(hugo_symbol))

n_rows_1 <- nrow(missing_entrez_df)
n_rows_2 <- nrow(missing_hugo_df)

Number of genomic regions missing an Entrez ID: 94

Number of genomic regions missing Hugo Symbol: 924

# How many different types of mutations has the dataset?
unique_values <- unique(maf_df$Variant_Classification)

# For selected nonsynonymous mutations based on literature
selected_nonsyn_mutations <- c(unique_values[1], unique_values[2], unique_values[7], unique_values[10], unique_values[12])

The mutation categories in the data are: Missense_Mutation, Silent, Splice_Site, Intron, 5’UTR, RNA, Nonsense_Mutation, IGR, 3’UTR, Start_Codon_SNP, lincRNA, Nonstop_Mutation

The mutation categories I will use as Nonsynonymous based on literature: Missense_Mutation, Silent, Nonsense_Mutation, Start_Codon_SNP, Nonstop_Mutation

3 Re-annotate Entrez IDs, Hugo Symbols, Ensembl Gene IDs

maf_df_annotated <- maf_df

#1 Re-annotate Hugo Symbols with Entrez IDs
## Step 1: Filter in rows with NA in hugo_symbol
entrez_ids <- maf_df_annotated %>% 
  dplyr::filter(is.na(hugo_symbol)) %>% 
  dplyr::pull(entrez_id) %>% 
  as.character()

## Step 2: Map Entrez IDs to Hugo Symbols
new_hugo_symbols <- ENTREZtoSYMBOL(entrez_ids)

## Step 3: Add the new_hugo_symbols to the dataframe
maf_df_annotated$update_indicator <- is.na(maf_df_annotated$hugo_symbol) & maf_df_annotated$entrez_id %in% entrez_ids # Create an temp indicator for rows to update
maf_df_annotated <- maf_df_annotated %>%
  dplyr::mutate(hugo_symbol = ifelse(update_indicator, new_hugo_symbols[match(entrez_id, entrez_ids)], hugo_symbol)) %>%
  dplyr::select(-update_indicator)  # Remove the indicator column after updating

#2 Re-annotate Entrez IDs with Hugo Symbols
## Step 1: Filter in rows with NA in entrez_id
hugo_symbols <- maf_df_annotated %>% 
  dplyr::filter(is.na(entrez_id)) %>% 
  dplyr::pull(hugo_symbol) %>% 
  as.character()

## Step 2: Map Hugo Symbols to Entrez IDs
new_entrez_ids <- SYMBOLtoENTREZ(hugo_symbols)

## Step 3: Add the new_entrez_ids to the dataframe
maf_df_annotated$update_indicator <- is.na(maf_df_annotated$entrez_id) & maf_df_annotated$hugo_symbol %in% hugo_symbols # Create an temp indicator for rows to update
maf_df_annotated <- maf_df_annotated %>%
  dplyr::mutate(entrez_id = ifelse(update_indicator, new_entrez_ids[match(hugo_symbol, hugo_symbols)], entrez_id)) %>%
  dplyr::select(-update_indicator)  # Remove the indicator column after updating

#3 Annotate Ensembl Gene IDs with Entrez IDs
## Step 1: Get entrez_ids
entrez_ids <- maf_df_annotated %>% 
  dplyr::pull(entrez_id) %>% 
  as.character()

## Step 2: Map Entrez IDs to Ensembl Gene IDs
ensembl_ids <- ENTREZtoENSEMBL(entrez_ids)

## Step 3: Add the new_entrez_ids to the dataframe
maf_df_annotated <- maf_df_annotated %>%
  dplyr::mutate(ensembl_id = ensembl_ids) %>% 
  dplyr::select(sample_id, ensembl_id, entrez_id, hugo_symbol, everything()) %>% 
  dplyr::filter(!(sample_id %in% c("MM909_20", "MM909_24")))

# Save RDS
maf_df_anno_path <- file.path(results_fip_path, "maf_df_annotated.rds")
saveRDS(maf_df_annotated, maf_df_anno_path)

There is a “problem” here: some Entrez IDs are mapped to several Ensembl Gene IDs. I need to resolve this because otherwise it will impact the TMB calculation and possibly other analyses. I decided to keep the first Ensembl Gene ID that is mapped.

4 Get a list of mutations for each patient

# Splitting the dataframe into a list based on Sample.ID
list_of_all_mutations <- split(maf_df_annotated, maf_df_annotated$sample_id)

# Save the maf_df_annotated into a file
maf_out_path <- file.path(results_fip_path, "all_mutations.csv")
write.csv(maf_df_annotated, file = maf_out_path, row.names = TRUE)

5 Get a list of Nonsynonymous mutations per patient

nonsyn_maf_df <- maf_df_annotated %>%
  dplyr::filter(Variant_Classification %in% nonsyn_categories) %>% 
  dplyr::arrange(sample_id)

list_of_nonsyn_mutations <- split(nonsyn_maf_df, nonsyn_maf_df$sample_id)

# Save the nonsyn_maf_df into a file
nonsyn_maf_out_path <- file.path(results_fip_path, 
                      "nonsyn_mutations.csv")
write.csv(nonsyn_maf_df, file = nonsyn_maf_out_path, row.names = TRUE)

6 Export info to use Ensembl VEP (web version)

### Extract nonsyn info in correct format for VEP input
api_input <- nonsyn_maf_df %>% 
  dplyr::select(Chromosome,
         Start_position,
         End_position,
         ref_allele,
         alt_allele,
         Strand,
         sample_id) %>% 
  dplyr::mutate(Allele_ref_alt = paste(ref_allele, 
                                alt_allele, 
                                sep = "/")) %>% 
  dplyr::mutate(API_info = paste(Chromosome,
                          Start_position,
                          End_position,
                          Allele_ref_alt,
                          Strand,
                          sample_id,
                          sep = " "))

### Export the info to a file and use the Web VEP
vep_input_data <- "../vep_input_nonsyn_grch37.txt"
vep_file_path <- file.path(data_path, 
                      vep_input_data)
write.table(api_input$API_info, file = vep_file_path, row.names = FALSE, col.names = FALSE, quote = FALSE)

7 Run VEP and explore output

### Define path
vep_out_data <- "../vep_output_nonsyn_grch37.txt"
vep_path <- file.path(data_path,
                      vep_out_data)

### Read data
vep_df <- read.csv(vep_path, header = TRUE, sep = "\t")

### Clean and wrangle
vep_df_clean <- vep_df %>% 
  dplyr::mutate(across(everything(), ~na_if(., "-"))) %>% 
  dplyr::select(where(~any(!is.na(.)))) %>% 
  dplyr::rename(sample_id = X.Uploaded_variation,
         ensembl_id = Gene) %>% 
  dplyr::filter(!(sample_id %in% c("MM909_20", "MM909_24"))) %>% 
  dplyr::mutate(
    SIFT_cleaned = str_extract(SIFT, "^[^(]+"), 
    PolyPhen_cleaned = str_extract(PolyPhen, "^[^(]+"),
    Liberal_consequence = case_when(
      SIFT_cleaned %in% c("deleterious", "deleterious_low_confidence") | 
      PolyPhen_cleaned %in% c("probably_damaging", "possibly_damaging") ~ "deleterious",
      TRUE ~ "non-deleterious"
    )
  )

The columns that do not have any information are: X.Uploaded_variation, Gene, MANE_SELECT, MANE_PLUS_CLINICAL, TSL, APPRIS, UNIPROT_ISOFORM, HGVS_OFFSET

The consideration of LoF mutations has been made in a “liberal” manner, meaning that if either SIFT or PolyPhen scores indicated the mutation to be deleterious, the mutation was considered LoF. Both metrics did not have to be in agreement to consider a mutation LoF.

8 Get a list of LoF mutations per patient

lof_vep_df <- vep_df_clean %>%
  dplyr::filter(Liberal_consequence == "deleterious") %>% 
  dplyr::mutate(entrez_id = SYMBOLtoENTREZ(SYMBOL)) %>% 
  dplyr::arrange(sample_id)

list_of_lof_mutations <- split(lof_vep_df, lof_vep_df$sample_id)

# Save the lof_vep_df into a file
lof_vep_out_path <- file.path(results_fip_path, 
                      "lof_mutations.csv")
write.csv(lof_vep_df, file = lof_vep_out_path, row.names = TRUE)

lof_vep_df_reduced <- lof_vep_df %>% 
  dplyr::rename(hugo_symbol = SYMBOL) %>% 
  dplyr::select(sample_id, ensembl_id, entrez_id, hugo_symbol, Location, Allele, Liberal_consequence) %>% 
  dplyr::distinct()
  
# Save the lof_vep_df_reduced into a file
lof_vep_reduced_out_path <- file.path(results_fip_path, 
                      "lof_mutations_reduced.csv")
write.csv(lof_vep_df_reduced, file = lof_vep_reduced_out_path, row.names = TRUE)

9 Calculate TMB per patient

# Step 1: Define the size of the sequenced region (in Mb)
sequenced_region_size_mb <- 25840698/1000000 # Taken from Ref: https://bmcresnotes.biomedcentral.com/articles/10.1186/s13104-019-4343-8

# Step 2: Filter for non-synonymous mutations based on literature
tmb_df <- maf_df_annotated %>%
  dplyr::filter(Variant_Classification %in% nonsyn_categories) %>% 
  dplyr::group_by(sample_id) %>%
  dplyr::summarise(
    total_mutations = n(),  # Count mutations for each sample
    TMB = total_mutations / sequenced_region_size_mb  # Calculate TMB
  ) %>%
  dplyr::mutate(TMB_class = case_when( # Define TMB class based on literature: 10 mut/Mb = High
    TMB >= 10 ~ "High",
    TMB < 10 ~ "Low")
  ) %>% 
  dplyr::arrange(desc(TMB)) # Arrange by TMB in descending order

# View the TMB for each sample/patient
datatable(tmb_df, 
          extensions = 'Buttons', 
          options = list(
            dom = 'Bfrtip',
            buttons = c('copy', 'excel', 'csv'),
            scrollX=TRUE,
            pageLength=10,
            columnDefs = list(list(
              targets = "_all",
              render = JS(
                "function(data, type, row, meta) {",
                "  return data === null ? 'NA' : data;",
                "}"
              )
            ))
          ),
          caption = "Number of mutations and (non-synonymous) TMB per patient"
        )

10 Plots

10.1 Summary bar plot of Nonsynonymous mutations

# Define output path
nonsyn_plot_path <- file.path(figures_fip_path, 
                              "nonsyn_plot.png")

# Count the occurrences of each unique value in Variant_Classification
top_variants <- nonsyn_maf_df %>%
  dplyr::count(Variant_Classification, name = "frequency") %>%
  dplyr::mutate(true_frequency = frequency / sum(frequency)) %>% 
  dplyr::arrange(desc(true_frequency))

# Create a bar plot
nonsyn_plot <- ggplot(top_variants, aes(x = reorder(Variant_Classification,
                                                    -true_frequency), 
                                     y = true_frequency, 
                                     fill = Variant_Classification)) +
  geom_bar(stat = "identity") +
  scale_fill_brewer(palette = "Set1") +  # Use a color palette from RColorBrewer
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "white", colour = "black"), # Set background to white with grey border
    panel.grid.major = element_line(color = "grey", linewidth = 0.5),  # Adjust major gridlines
    panel.grid.minor = element_blank(),  # Hide minor gridlines for a cleaner look
    axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1),  # Tilt x-axis labels
    plot.background = element_rect(fill = "white", colour = NA)  # Set plot background to white
  ) +
  labs(title = "Nonsynonymous mutations' frequency",
       x = "Variant Classification", 
       y = "Relative Frequency") +
  scale_y_continuous(breaks = seq(0, 1, by = 0.1))  # Set y-axis breaks every 0.1

# Print plot
print(nonsyn_plot)

# Save plot
ggsave(nonsyn_plot_path, nonsyn_plot, width = 10, height = 8, dpi = 300)

10.2 SIFT summary bar plot of LoF mutations

# Define output path
lof_SIFT_plot_path <- file.path(figures_fip_path, 
                           "lof_SIFT_plot.png")

# Count the occurrences of each unique value in Consequence and calculate the true frequency
top_SIFT_lof_variants <- lof_vep_df %>%
  dplyr::count(SIFT_cleaned, name = "frequency") %>%
  dplyr::mutate(true_frequency = frequency / sum(frequency)) %>%
  dplyr::arrange(desc(true_frequency)) %>%
  dplyr::slice_max(order_by = true_frequency, n = 5)

# Create a bar plot with the true frequency
lof_SIFT_plot <- ggplot(top_SIFT_lof_variants, aes(x = reorder(SIFT_cleaned, 
                                                     -true_frequency), 
                                                   y = true_frequency, 
                                                   fill = SIFT_cleaned)) +
  geom_bar(stat = "identity") +
  scale_fill_brewer(palette = "Set1") +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "white", colour = "black"),
    panel.grid.major = element_line(color = "grey", linewidth = 0.5),
    panel.grid.minor = element_blank(),
    axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1),
    plot.background = element_rect(fill = "white", colour = NA)
  ) +
  labs(title = "Top 5 Most Frequent SIFT LoF Consequences (Relative Frequency)",
       x = "SIFT Consequence", 
       y = "Relative Frequency") +
  scale_y_continuous(breaks = seq(0, 1, by = 0.1))  # Set y-axis breaks every 0.1

# Print plot
print(lof_SIFT_plot)

# Save plot
ggsave(lof_SIFT_plot_path, lof_SIFT_plot, width = 10, height = 8, dpi = 300)

10.3 PolyPhen summary bar plot of LoF mutations

# Define output path
lof_PolyPhen_plot_path <- file.path(figures_fip_path, 
                           ".lof_PolyPhen_plot.png")

# Count the occurrences of each unique value in Consequence and calculate the true frequency
top_PolyPhen_lof_variants <- lof_vep_df %>%
  dplyr::count(PolyPhen_cleaned, name = "frequency") %>%
  dplyr::mutate(true_frequency = frequency / sum(frequency)) %>%
  dplyr::arrange(desc(true_frequency)) %>%
  dplyr::slice_max(order_by = true_frequency, n = 5)

# Create a bar plot with the true frequency
lof_PolyPhen_plot <- ggplot(top_PolyPhen_lof_variants, aes(x = reorder(PolyPhen_cleaned, 
                                                     -true_frequency), 
                                                   y = true_frequency, 
                                                   fill = PolyPhen_cleaned)) +
  geom_bar(stat = "identity") +
  scale_fill_brewer(palette = "Set1") +
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "white", colour = "black"),
    panel.grid.major = element_line(color = "grey", linewidth = 0.5),
    panel.grid.minor = element_blank(),
    axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1),
    plot.background = element_rect(fill = "white", colour = NA)
  ) +
  labs(title = "Top 5 Most Frequent PolyPhen LoF Consequences (Relative Frequency)",
       x = "PolyPhen Consequence", 
       y = "Relative Frequency") +
  scale_y_continuous(breaks = seq(0, 1, by = 0.1))  # Set y-axis breaks every 0.1

# Print plot
print(lof_PolyPhen_plot)

# Save plot
ggsave(lof_PolyPhen_plot_path, lof_PolyPhen_plot, width = 10, height = 8, dpi = 300)

10.4 Box plot of TMB grouped by response

#Fig2a

# Merge sup1_response with tmb_df
tmb_response_df <- tmb_df %>% 
  left_join(sup1_response_df %>% 
            dplyr::select(Sample.ID, Patient.Response),
            by = c("sample_id" = "Sample.ID")
  ) %>% 
  dplyr::select(sample_id,
         TMB,
         patient_response = Patient.Response) %>% 
  dplyr::filter(!(sample_id %in% c("MM909_20", "MM909_24")))

# Perform the Mann-Whitney test and extract p-value
test_result <- compare_means(TMB ~ patient_response, data = tmb_response_df, method = "wilcox.test", p.adjust.method = "none")

# Print the test result to see the p-value
print(test_result)
## # A tibble: 1 × 8
##   .y.   group1 group2      p p.adj p.format p.signif method  
##   <chr> <chr>  <chr>   <dbl> <dbl> <chr>    <chr>    <chr>   
## 1 TMB   R      NR     0.0249 0.025 0.025    *        Wilcoxon
# Define output path
tmb_boxplot_path <- file.path(figures_fip_path, 
                           "tmb_boxplot.png")

# Create a boxplot with medians and p-value displayed
tmb_boxplot <- ggplot(tmb_response_df, aes(x = patient_response, 
                                           y = TMB, 
                                           fill = patient_response)) +
  geom_boxplot() +
  stat_summary(fun = median, geom = "text", aes(label = round(..y.., 2)), 
               position = position_nudge(x = 0, y = 1.5), size = 4, color = "white") +
  stat_compare_means(method = "wilcox.test", label = "p.format", label.x = 1.5) +  # Add p-value from Mann-Whitney test
  scale_fill_manual(values = c(R = "#009E73", NR = "#D55E00"),
                    labels = c("R" = "Responders", "NR" = "Non-responders")) +
  scale_x_discrete(labels = c("NR" = "Non-responders", 
                              "R" = "Responders")) +  # Manually set x-axis labels
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "white", colour = "black"),
    panel.grid.major = element_line(color = "grey", linewidth = 0.5),
    panel.grid.minor = element_blank(),
    plot.background = element_rect(fill = "white", colour = NA)
  ) +
  labs(title = NULL,
       x = "Patient Response",
       y = "TMB (mutations/Mb)",
       fill = "Patient Response")

# Print plot
print(tmb_boxplot)

# Save plot
ggsave(tmb_boxplot_path, tmb_boxplot, width = 8, height = 6, dpi = 300)

10.5 Box plot of LoF mutations grouped by response

#Fig5

# Merge sup1_response with lof_vep_df_reduced
lof_response_df <- lof_vep_df_reduced %>% 
  left_join(sup1_response_df %>% 
            dplyr::select(Sample.ID, Patient.Response),
            by = c("sample_id" = "Sample.ID")
  ) %>% 
  dplyr::filter(!(sample_id %in% c("MM909_20", "MM909_24"))) %>% 
  dplyr::rename(patient_response = Patient.Response)

# Calculate the sum of mutations for each sample
lof_counts <- lof_response_df %>%
  group_by(sample_id) %>%
  summarise(lof_count = n()) %>%
  ungroup()

# Join the lof_count back to the original data frame
lof_count_response_df <- lof_response_df %>%
  left_join(lof_counts, by = "sample_id") %>% 
  dplyr::select(sample_id, patient_response, lof_count) %>% 
  dplyr::distinct()

# Perform the Mann-Whitney test and extract p-value
test_result <- compare_means(lof_count ~ patient_response, data = lof_count_response_df, method = "wilcox.test", p.adjust.method = "none")

# Print the test result to see the p-value
print(test_result)
## # A tibble: 1 × 8
##   .y.       group1 group2      p p.adj p.format p.signif method  
##   <chr>     <chr>  <chr>   <dbl> <dbl> <chr>    <chr>    <chr>   
## 1 lof_count NR     R      0.0206 0.021 0.021    *        Wilcoxon
# Define output path
lof_boxplot_path <- file.path(figures_fip_path, 
                           "lof_boxplot.png")

# Create a boxplot with medians and p-value displayed
lof_boxplot <- ggplot(lof_count_response_df, aes(x = patient_response, 
                                           y = lof_count, 
                                           fill = patient_response)) +
  geom_boxplot() +
  stat_summary(fun = median, geom = "text", aes(label = round(..y.., 2)), 
               position = position_nudge(x = 0, y = 18), size = 4, color = "white") +
  stat_compare_means(method = "wilcox.test", label = "p.format", label.x = 1.5) +  # Add p-value from Mann-Whitney test
  scale_fill_manual(values = c(R = "#009E73", NR = "#D55E00"),
                    labels = c("R" = "Responders", "NR" = "Non-responders")) +
  scale_x_discrete(labels = c("NR" = "Non-responders", 
                              "R" = "Responders")) +  # Manually set x-axis labels
  theme_minimal() +
  theme(
    panel.background = element_rect(fill = "white", colour = "black"),
    panel.grid.major = element_line(color = "grey", linewidth = 0.5),
    panel.grid.minor = element_blank(),
    plot.background = element_rect(fill = "white", colour = NA)
  ) +
  labs(title = NULL,
       x = "Patient Response",
       y = "nº LoF mutations",
       fill = "Patient Response")

# Print plot
print(lof_boxplot)

# Save plot
ggsave(lof_boxplot_path, lof_boxplot, width = 8, height = 6, dpi = 300)

11 MAFtools

11.1 All mutations

11.1.1 Load data

# Define paths
maf_data <- "41467_2017_1460_MOESM6_ESM_somatic_mutations.xlsx"
maf_path <- file.path(data_path, 
                      maf_data)
clinical_data <- "41467_2017_1460_MOESM4_ESM_clinical.xlsx"
clinical_path <- file.path(data_path, 
                      clinical_data)

# Read data
maf_df <- read_excel(maf_path,
                        skip=1,
                        col_names=TRUE) %>% 
  mutate(sample_id = sub("_[12]$", "", tumor_name)) %>% 
  dplyr::select(sample_id, everything()) %>% 
  arrange(sample_id) %>% 
  dplyr::filter(!(sample_id %in% c("MM909_20", "MM909_24")))
  
clinical_df <- read_excel(clinical_path,
                          skip=1,
                          col_names=TRUE)
colnames(clinical_df)[1] <- "sample_id"

# Add Tumor_Sample_Barcode to clinical_df
mapping_df <- maf_df_annotated %>%
  dplyr::select(sample_id, Tumor_Sample_Barcode) %>%
  distinct()

# Clean sup1_response_df
clinical_resp_df <- sup1_response_df %>% 
  dplyr::rename(sample_id = Sample.ID,
                Patient_Response = Patient.Response) %>% 
  dplyr::mutate(
    Patient_Response = case_when(
      Patient_Response == "R" ~ "Responders",
      Patient_Response == "NR" ~ "Non-responders"
    )
  )

clinical_resp_df <- clinical_resp_df %>%
  left_join(mapping_df, by = "sample_id") %>% 
  dplyr::rename(Sample_ID = sample_id)

maf_df_annotated <- maf_df_annotated %>% 
  dplyr::rename(Sample_ID = sample_id)

# Load maf with clinical data
mm909 = read.maf(maf = maf_df_annotated, clinicalData = clinical_resp_df)
## -Validating
## -Silent variants: 3778 
## -Summarizing
## --Possible FLAGS among top ten genes:
##   MUC16
##   TTN
## -Processing clinical data
## -Finished in 1.499s elapsed (0.935s cpu)

11.1.2 Summaries

## Shows sample summry.
sample_sum <- getSampleSummary(mm909)
getSampleSummary(mm909)
##     Tumor_Sample_Barcode Missense_Mutation Nonsense_Mutation Nonstop_Mutation
##                   <fctr>             <int>             <int>            <int>
##  1:           MM909_22_1              1271                65                1
##  2:           MM909_03_1              1159                67                0
##  3:           MM909_26_1               828                47                0
##  4:           MM909_42_1               398                24                0
##  5:           MM909_43_1               349                27                0
##  6:           MM909_15_2               342                21                0
##  7:           MM909_46_1               287                22                0
##  8:           MM909_16_1               285                19                0
##  9:           MM909_17_1               237                 8                1
## 10:           MM909_25_1               168                12                0
## 11:           MM909_11_1               155                14                0
## 12:           MM909_31_1               150                12                0
## 13:           MM909_40_1               138                 9                1
## 14:           MM909_02_1               111                 5                0
## 15:           MM909_35_1               101                 3                0
## 16:           MM909_34_2                87                 9                0
## 17:           MM909_37_1                76                 5                0
## 18:           MM909_27_1                68                 2                1
## 19:           MM909_06_1                46                 4                0
## 20:           MM909_36_1                45                 4                0
## 21:           MM909_14_1                29                 2                0
## 22:           MM909_47_1                15                 0                0
##     Tumor_Sample_Barcode Missense_Mutation Nonsense_Mutation Nonstop_Mutation
##     Splice_Site total
##           <int> <num>
##  1:          52  1389
##  2:          59  1285
##  3:          28   903
##  4:          14   436
##  5:          16   392
##  6:          13   376
##  7:          10   319
##  8:          11   315
##  9:          19   265
## 10:           6   186
## 11:           9   178
## 12:          11   173
## 13:           8   156
## 14:           9   125
## 15:           3   107
## 16:           4   100
## 17:           2    83
## 18:           2    73
## 19:           2    52
## 20:           1    50
## 21:           4    35
## 22:           2    17
##     Splice_Site total
## Shows gene summary.
getGeneSummary(mm909)
##       Hugo_Symbol Missense_Mutation Nonsense_Mutation Nonstop_Mutation
##            <char>             <int>             <int>            <int>
##    1:        BRAF                16                 0                0
##    2:     MIR548N                25                 5                0
##    3:       MUC16                40                 1                0
##    4:         TTN                30                 1                0
##    5:        PCLO                14                 1                0
##   ---                                                                 
## 4623:       ZPLD1                 1                 0                0
## 4624:     ZSCAN18                 1                 0                0
## 4625:     ZSCAN31                 1                 0                0
## 4626:      ZSWIM5                 1                 0                0
## 4627:      ZWILCH                 1                 0                0
##       Splice_Site total MutatedSamples AlteredSamples
##             <int> <num>          <int>          <int>
##    1:           0    16             14             14
##    2:           0    30             13             13
##    3:           0    41             12             12
##    4:           0    31             11             11
##    5:           0    15              9              9
##   ---                                                
## 4623:           0     1              1              1
## 4624:           0     1              1              1
## 4625:           0     1              1              1
## 4626:           0     1              1              1
## 4627:           0     1              1              1
## Shows clinical data associated with samples
getClinicalData(mm909)
##     Sample_ID               Sample.Timepoint AJCC.Stage PFS.Time PFS.Event
##        <char>                         <char>     <char>   <char>    <char>
##  1:  MM909_02                    Before TILs        M1b     2.00         1
##  2:  MM909_03                    Before TILs        M1c     3.80         1
##  3:  MM909_06                    Before TILs        M1c     2.30         1
##  4:  MM909_11                    Before TILs        M1a    13.10         1
##  5:  MM909_14                    Before TILs        M1c     2.50         1
##  6:  MM909_15                    Before TILs        M1b    67.13         0
##  7:  MM909_16                    Before TILs        M1c     3.90         1
##  8:  MM909_17                    Before TILs        M1c    64.87         0
##  9:  MM909_22   After Ipilimumab/Before TILs        M1c    32.10         0
## 10:  MM909_25                    Before TILs        M1b     3.77         1
## 11:  MM909_26                    Before TILs        M1c    52.70         0
## 12:  MM909_27 Before Vemurafenib/Before TILs        M1c     2.00         1
## 13:  MM909_31                    Before TILs        M1c    11.30         1
## 14:  MM909_34                    Before TILs        M1c     2.83         1
## 15:  MM909_35 During Vemurafenib/Before TILs        M1c     3.13         1
## 16:  MM909_36 During Vemurafenib/Before TILs        M1c     8.23         1
## 17:  MM909_37                    Before TILs        M1c     3.03         1
## 18:  MM909_40                    Before TILs        M1c     3.73         1
## 19:  MM909_42                    Before TILs        M1c    42.30         0
## 20:  MM909_43                    Before TILs        M1c     1.93         1
## 21:  MM909_46                    Before TILs        M1c     5.83         1
## 22:  MM909_47                    Before TILs        M1c     3.27         1
##     Sample_ID               Sample.Timepoint AJCC.Stage PFS.Time PFS.Event
##     OS.Time OS.Event Type.of.Lesion Type.of.Primary RECIST Patient_Response
##      <char>   <char>         <char>          <char> <char>           <char>
##  1:     6.9        1             LN            skin     PD   Non-responders
##  2:    11.4        1             SC         unknown     SD   Non-responders
##  3:     4.6        1             LN            skin     PD   Non-responders
##  4:    71.5        0             LN            skin     CR       Responders
##  5:     3.2        1             LN         unknown     PD   Non-responders
##  6:    67.1        0             LN            skin     CR       Responders
##  7:    65.3        0             SC            skin     SD       Responders
##  8:    64.9        0             LN            skin     PR       Responders
##  9:    32.1        1           <NA>            skin     PR       Responders
## 10:     5.5        1             LN            skin     SD   Non-responders
## 11:    52.7        0             IM            skin     CR       Responders
## 12:     3.5        1             SC            skin     PD   Non-responders
## 13:    20.1        1             SC          mucosa     PR       Responders
## 14:     5.0        1             LN          mucosa     SD   Non-responders
## 15:    23.7        1             SC            skin     SD   Non-responders
## 16:    24.6        1             IA            skin     PR       Responders
## 17:    12.1        1             SC            skin     SD   Non-responders
## 18:    14.0        1             IA            skin     SD   Non-responders
## 19:    42.3        0             SC            skin     CR       Responders
## 20:    22.8        1             SC         unknown     PD   Non-responders
## 21:    24.8        1             LN            skin     SD       Responders
## 22:    18.9        1         pleura         unknown     SD   Non-responders
##     OS.Time OS.Event Type.of.Lesion Type.of.Primary RECIST Patient_Response
##     mut_load Tumor_Sample_Barcode
##       <char>               <char>
##  1:      199           MM909_02_1
##  2:     2036           MM909_03_1
##  3:       86           MM909_06_1
##  4:      277           MM909_11_1
##  5:       62           MM909_14_1
##  6:      581           MM909_15_2
##  7:      493           MM909_16_1
##  8:      366           MM909_17_1
##  9:     2200           MM909_22_1
## 10:      295           MM909_25_1
## 11:     1378           MM909_26_1
## 12:      110           MM909_27_1
## 13:      246           MM909_31_1
## 14:      157           MM909_34_2
## 15:      180           MM909_35_1
## 16:       85           MM909_36_1
## 17:      131           MM909_37_1
## 18:      214           MM909_40_1
## 19:      654           MM909_42_1
## 20:      601           MM909_43_1
## 21:      488           MM909_46_1
## 22:       23           MM909_47_1
##     mut_load Tumor_Sample_Barcode
## Shows all fields in MAF
getFields(mm909)
##  [1] "Sample_ID"              "ensembl_id"             "entrez_id"             
##  [4] "Hugo_Symbol"            "contig"                 "position"              
##  [7] "context"                "ref_allele"             "alt_allele"            
## [10] "tumor_name"             "normal_name"            "score"                 
## [13] "dbsnp_site"             "covered"                "power"                 
## [16] "tumor_power"            "normal_power"           "total_pairs"           
## [19] "improper_pairs"         "map_Q0_reads"           "t_lod_fstar"           
## [22] "tumor_f"                "contaminant_fraction"   "contaminant_lod"       
## [25] "t_ref_count"            "t_alt_count"            "t_ref_sum"             
## [28] "t_alt_sum"              "t_ref_max_mapq"         "t_alt_max_mapq"        
## [31] "t_ins_count"            "t_del_count"            "normal_best_gt"        
## [34] "init_n_lod"             "n_ref_count"            "n_alt_count"           
## [37] "n_ref_sum"              "n_alt_sum"              "judgement"             
## [40] "chrom23"                "Chromosome"             "Start_Position"        
## [43] "End_Position"           "Strand"                 "Tumor_Sample_Barcode"  
## [46] "Center"                 "NCBI_Build"             "Variant_Classification"
## [49] "Variant_Type"           "Reference_Allele"       "Tumor_Seq_Allele1"     
## [52] "Tumor_Seq_Allele2"      "cDNA_Change"            "Codon_Change"          
## [55] "Protein_Change"
## Shows clinical enrichment
clinicalEnrichment(mm909, "Patient_Response")
## 
## Non-responders     Responders 
##             12             10 
##     Hugo_Symbol  Feature_1      Feature_2 n_mutated_Feature1 n_mutated_Feature2
##          <char>     <char>         <char>             <char>             <char>
##  1:        BRAF Responders Non-responders            6 of 10            8 of 12
##  2:        BRAF       <NA>           <NA>               <NA>               <NA>
##  3:        BRAF       <NA>           <NA>               <NA>               <NA>
##  4:     MIR548N Responders Non-responders            8 of 10            5 of 12
##  5:     MIR548N       <NA>           <NA>               <NA>               <NA>
##  6:     MIR548N       <NA>           <NA>               <NA>               <NA>
##  7:       MUC16 Responders Non-responders            8 of 10            4 of 12
##  8:       MUC16       <NA>           <NA>               <NA>               <NA>
##  9:       MUC16       <NA>           <NA>               <NA>               <NA>
## 10:         TTN Responders Non-responders            5 of 10            6 of 12
## 11:         TTN       <NA>           <NA>               <NA>               <NA>
## 12:         TTN       <NA>           <NA>               <NA>               <NA>
## 13:        PCLO Responders Non-responders            4 of 10            5 of 12
## 14:        PCLO       <NA>           <NA>               <NA>               <NA>
## 15:        PCLO       <NA>           <NA>               <NA>               <NA>
## 16:       DNAH5 Responders Non-responders            5 of 10            4 of 12
## 17:       DNAH5       <NA>           <NA>               <NA>               <NA>
## 18:       DNAH5       <NA>           <NA>               <NA>               <NA>
## 19:       LRP1B Responders Non-responders            5 of 10            2 of 12
## 20:       LRP1B       <NA>           <NA>               <NA>               <NA>
## 21:       LRP1B       <NA>           <NA>               <NA>               <NA>
## 22:       FSIP2 Responders Non-responders            4 of 10            3 of 12
## 23:       FSIP2       <NA>           <NA>               <NA>               <NA>
## 24:       FSIP2       <NA>           <NA>               <NA>               <NA>
## 25:       PTPRT Responders Non-responders            4 of 10            3 of 12
## 26:       PTPRT       <NA>           <NA>               <NA>               <NA>
## 27:       PTPRT       <NA>           <NA>               <NA>               <NA>
## 28:       CSMD1 Responders Non-responders            3 of 10            4 of 12
## 29:       CSMD1       <NA>           <NA>               <NA>               <NA>
## 30:       CSMD1       <NA>           <NA>               <NA>               <NA>
## 31:       USH2A Responders Non-responders            5 of 10            2 of 12
## 32:       USH2A       <NA>           <NA>               <NA>               <NA>
## 33:       USH2A       <NA>           <NA>               <NA>               <NA>
## 34:      SCN10A Responders Non-responders            4 of 10            3 of 12
## 35:      SCN10A       <NA>           <NA>               <NA>               <NA>
## 36:      SCN10A       <NA>           <NA>               <NA>               <NA>
## 37:       HYDIN Responders Non-responders            5 of 10            2 of 12
## 38:       HYDIN       <NA>           <NA>               <NA>               <NA>
## 39:       HYDIN       <NA>           <NA>               <NA>               <NA>
## 40:        ZIM2 Responders Non-responders            5 of 10            2 of 12
## 41:        ZIM2       <NA>           <NA>               <NA>               <NA>
## 42:        ZIM2       <NA>           <NA>               <NA>               <NA>
## 43:      ABCA13 Responders Non-responders            3 of 10            3 of 12
## 44:      ABCA13       <NA>           <NA>               <NA>               <NA>
## 45:      ABCA13       <NA>           <NA>               <NA>               <NA>
## 46:       DNAH8 Responders Non-responders            4 of 10            2 of 12
## 47:       DNAH8       <NA>           <NA>               <NA>               <NA>
## 48:       DNAH8       <NA>           <NA>               <NA>               <NA>
## 49:      FAM83B Responders Non-responders            4 of 10            2 of 12
## 50:      FAM83B       <NA>           <NA>               <NA>               <NA>
## 51:      FAM83B       <NA>           <NA>               <NA>               <NA>
## 52:       DSCAM Responders Non-responders            3 of 10            3 of 12
## 53:       DSCAM       <NA>           <NA>               <NA>               <NA>
## 54:       DSCAM       <NA>           <NA>               <NA>               <NA>
## 55:      MYO15A Responders Non-responders            3 of 10            3 of 12
## 56:      MYO15A       <NA>           <NA>               <NA>               <NA>
## 57:      MYO15A       <NA>           <NA>               <NA>               <NA>
## 58:       DNAH6 Responders Non-responders            3 of 10            3 of 12
## 59:       DNAH6       <NA>           <NA>               <NA>               <NA>
## 60:       DNAH6       <NA>           <NA>               <NA>               <NA>
## 61:       WDFY4 Responders Non-responders            4 of 10            2 of 12
## 62:       WDFY4       <NA>           <NA>               <NA>               <NA>
## 63:       WDFY4       <NA>           <NA>               <NA>               <NA>
## 64:      COL4A5 Responders Non-responders            4 of 10            2 of 12
## 65:      COL4A5       <NA>           <NA>               <NA>               <NA>
## 66:      COL4A5       <NA>           <NA>               <NA>               <NA>
## 67:        FAT4 Responders Non-responders            4 of 10            2 of 12
## 68:        FAT4       <NA>           <NA>               <NA>               <NA>
## 69:        FAT4       <NA>           <NA>               <NA>               <NA>
## 70:        MYH8 Responders Non-responders            5 of 10            1 of 12
## 71:        MYH8       <NA>           <NA>               <NA>               <NA>
## 72:        MYH8       <NA>           <NA>               <NA>               <NA>
## 73:       PKHD1 Responders Non-responders            5 of 10            1 of 12
## 74:       PKHD1       <NA>           <NA>               <NA>               <NA>
## 75:       PKHD1       <NA>           <NA>               <NA>               <NA>
## 76:       CNTN5 Responders Non-responders            3 of 10            3 of 12
## 77:       CNTN5       <NA>           <NA>               <NA>               <NA>
## 78:       CNTN5       <NA>           <NA>               <NA>               <NA>
## 79:       EPHA6 Responders Non-responders            5 of 10            1 of 12
## 80:       EPHA6       <NA>           <NA>               <NA>               <NA>
## 81:       EPHA6       <NA>           <NA>               <NA>               <NA>
## 82:      SHANK1 Responders Non-responders            2 of 10            4 of 12
## 83:      SHANK1       <NA>           <NA>               <NA>               <NA>
## 84:      SHANK1       <NA>           <NA>               <NA>               <NA>
##     Hugo_Symbol  Feature_1      Feature_2 n_mutated_Feature1 n_mutated_Feature2
##            fdr Analysis         Group1 Group2 n_mutated_group1 n_mutated_group2
##          <num>   <char>         <char> <char>           <char>           <char>
##  1: 1.00000000 Pairwise           <NA>   <NA>             <NA>             <NA>
##  2:         NA    Group Non-responders   Rest          8 of 12          6 of 10
##  3:         NA    Group     Responders   Rest          6 of 10          8 of 12
##  4: 0.09907121 Pairwise           <NA>   <NA>             <NA>             <NA>
##  5:         NA    Group Non-responders   Rest          5 of 12          8 of 10
##  6:         NA    Group     Responders   Rest          8 of 10          5 of 12
##  7: 0.04273126 Pairwise           <NA>   <NA>             <NA>             <NA>
##  8:         NA    Group Non-responders   Rest          4 of 12          8 of 10
##  9:         NA    Group     Responders   Rest          8 of 10          4 of 12
## 10: 1.00000000 Pairwise           <NA>   <NA>             <NA>             <NA>
## 11:         NA    Group Non-responders   Rest          6 of 12          5 of 10
## 12:         NA    Group     Responders   Rest          5 of 10          6 of 12
## 13: 1.00000000 Pairwise           <NA>   <NA>             <NA>             <NA>
## 14:         NA    Group Non-responders   Rest          5 of 12          4 of 10
## 15:         NA    Group     Responders   Rest          4 of 10          5 of 12
## 16: 0.66563467 Pairwise           <NA>   <NA>             <NA>             <NA>
## 17:         NA    Group Non-responders   Rest          4 of 12          5 of 10
## 18:         NA    Group     Responders   Rest          5 of 10          4 of 12
## 19: 0.17182663 Pairwise           <NA>   <NA>             <NA>             <NA>
## 20:         NA    Group Non-responders   Rest          2 of 12          5 of 10
## 21:         NA    Group     Responders   Rest          5 of 10          2 of 12
## 22: 0.65170279 Pairwise           <NA>   <NA>             <NA>             <NA>
## 23:         NA    Group Non-responders   Rest          3 of 12          4 of 10
## 24:         NA    Group     Responders   Rest          4 of 10          3 of 12
## 25: 0.65170279 Pairwise           <NA>   <NA>             <NA>             <NA>
## 26:         NA    Group Non-responders   Rest          3 of 12          4 of 10
## 27:         NA    Group     Responders   Rest          4 of 10          3 of 12
## 28: 1.00000000 Pairwise           <NA>   <NA>             <NA>             <NA>
## 29:         NA    Group Non-responders   Rest          4 of 12          3 of 10
## 30:         NA    Group     Responders   Rest          3 of 10          4 of 12
## 31: 0.17182663 Pairwise           <NA>   <NA>             <NA>             <NA>
## 32:         NA    Group Non-responders   Rest          2 of 12          5 of 10
## 33:         NA    Group     Responders   Rest          5 of 10          2 of 12
## 34: 0.65170279 Pairwise           <NA>   <NA>             <NA>             <NA>
## 35:         NA    Group Non-responders   Rest          3 of 12          4 of 10
## 36:         NA    Group     Responders   Rest          4 of 10          3 of 12
## 37: 0.17182663 Pairwise           <NA>   <NA>             <NA>             <NA>
## 38:         NA    Group Non-responders   Rest          2 of 12          5 of 10
## 39:         NA    Group     Responders   Rest          5 of 10          2 of 12
## 40: 0.17182663 Pairwise           <NA>   <NA>             <NA>             <NA>
## 41:         NA    Group Non-responders   Rest          2 of 12          5 of 10
## 42:         NA    Group     Responders   Rest          5 of 10          2 of 12
## 43: 1.00000000 Pairwise           <NA>   <NA>             <NA>             <NA>
## 44:         NA    Group Non-responders   Rest          3 of 12          3 of 10
## 45:         NA    Group     Responders   Rest          3 of 10          3 of 12
## 46: 0.34763379 Pairwise           <NA>   <NA>             <NA>             <NA>
## 47:         NA    Group Non-responders   Rest          2 of 12          4 of 10
## 48:         NA    Group     Responders   Rest          4 of 10          2 of 12
## 49: 0.34763379 Pairwise           <NA>   <NA>             <NA>             <NA>
## 50:         NA    Group Non-responders   Rest          2 of 12          4 of 10
## 51:         NA    Group     Responders   Rest          4 of 10          2 of 12
## 52: 1.00000000 Pairwise           <NA>   <NA>             <NA>             <NA>
## 53:         NA    Group Non-responders   Rest          3 of 12          3 of 10
## 54:         NA    Group     Responders   Rest          3 of 10          3 of 12
## 55: 1.00000000 Pairwise           <NA>   <NA>             <NA>             <NA>
## 56:         NA    Group Non-responders   Rest          3 of 12          3 of 10
## 57:         NA    Group     Responders   Rest          3 of 10          3 of 12
## 58: 1.00000000 Pairwise           <NA>   <NA>             <NA>             <NA>
## 59:         NA    Group Non-responders   Rest          3 of 12          3 of 10
## 60:         NA    Group     Responders   Rest          3 of 10          3 of 12
## 61: 0.34763379 Pairwise           <NA>   <NA>             <NA>             <NA>
## 62:         NA    Group Non-responders   Rest          2 of 12          4 of 10
## 63:         NA    Group     Responders   Rest          4 of 10          2 of 12
## 64: 0.34763379 Pairwise           <NA>   <NA>             <NA>             <NA>
## 65:         NA    Group Non-responders   Rest          2 of 12          4 of 10
## 66:         NA    Group     Responders   Rest          4 of 10          2 of 12
## 67: 0.34763379 Pairwise           <NA>   <NA>             <NA>             <NA>
## 68:         NA    Group Non-responders   Rest          2 of 12          4 of 10
## 69:         NA    Group     Responders   Rest          4 of 10          2 of 12
## 70: 0.05572755 Pairwise           <NA>   <NA>             <NA>             <NA>
## 71:         NA    Group Non-responders   Rest          1 of 12          5 of 10
## 72:         NA    Group     Responders   Rest          5 of 10          1 of 12
## 73: 0.05572755 Pairwise           <NA>   <NA>             <NA>             <NA>
## 74:         NA    Group Non-responders   Rest          1 of 12          5 of 10
## 75:         NA    Group     Responders   Rest          5 of 10          1 of 12
## 76: 1.00000000 Pairwise           <NA>   <NA>             <NA>             <NA>
## 77:         NA    Group Non-responders   Rest          3 of 12          3 of 10
## 78:         NA    Group     Responders   Rest          3 of 10          3 of 12
## 79: 0.05572755 Pairwise           <NA>   <NA>             <NA>             <NA>
## 80:         NA    Group Non-responders   Rest          1 of 12          5 of 10
## 81:         NA    Group     Responders   Rest          5 of 10          1 of 12
## 82: 0.64617426 Pairwise           <NA>   <NA>             <NA>             <NA>
## 83:         NA    Group Non-responders   Rest          4 of 12          2 of 10
## 84:         NA    Group     Responders   Rest          2 of 10          4 of 12
##            fdr Analysis         Group1 Group2 n_mutated_group1 n_mutated_group2
##        p_value        OR      OR_low    OR_high
##          <num>     <num>       <num>      <num>
##  1:         NA        NA          NA         NA
##  2: 1.00000000 1.3158848 0.166513699  10.588251
##  3: 1.00000000 0.7599449 0.094444307   6.005512
##  4:         NA        NA          NA         NA
##  5: 0.09907121 0.1943170 0.014105470   1.601714
##  6: 0.09907121 5.1462289 0.624331001  70.894480
##  7:         NA        NA          NA         NA
##  8: 0.04273126 0.1393973 0.009829588   1.164437
##  9: 0.04273126 7.1737384 0.858784223 101.733669
## 10:         NA        NA          NA         NA
## 11: 1.00000000 1.0000000 0.138668627   7.211437
## 12: 1.00000000 1.0000000 0.138668627   7.211437
## 13:         NA        NA          NA         NA
## 14: 1.00000000 1.0680540 0.144162138   8.236116
## 15: 1.00000000 0.9362822 0.121416450   6.936634
## 16:         NA        NA          NA         NA
## 17: 0.66563467 0.5163899 0.064087475   3.791432
## 18: 0.66563467 1.9365213 0.263752588  15.603673
## 19:         NA        NA          NA         NA
## 20: 0.17182663 0.2166050 0.015292506   1.914989
## 21: 0.17182663 4.6166977 0.522196276  65.391505
## 22:         NA        NA          NA         NA
## 23: 0.65170279 0.5163825 0.054045583   4.332564
## 24: 0.65170279 1.9365490 0.230810220  18.502900
## 25:         NA        NA          NA         NA
## 26: 0.65170279 0.5163825 0.054045583   4.332564
## 27: 0.65170279 1.9365490 0.230810220  18.502900
## 28:         NA        NA          NA         NA
## 29: 1.00000000 1.1585362 0.137618146  10.854999
## 30: 1.00000000 0.8631582 0.092123452   7.266484
## 31:         NA        NA          NA         NA
## 32: 0.17182663 0.2166050 0.015292506   1.914989
## 33: 0.17182663 4.6166977 0.522196276  65.391505
## 34:         NA        NA          NA         NA
## 35: 0.65170279 0.5163825 0.054045583   4.332564
## 36: 0.65170279 1.9365490 0.230810220  18.502900
## 37:         NA        NA          NA         NA
## 38: 0.17182663 0.2166050 0.015292506   1.914989
## 39: 0.17182663 4.6166977 0.522196276  65.391505
## 40:         NA        NA          NA         NA
## 41: 0.17182663 0.2166050 0.015292506   1.914989
## 42: 0.17182663 4.6166977 0.522196276  65.391505
## 43:         NA        NA          NA         NA
## 44: 1.00000000 0.7867773 0.078561110   7.821058
## 45: 1.00000000 1.2710078 0.127859942  12.728944
## 46:         NA        NA          NA         NA
## 47: 0.34763379 0.3176677 0.022167729   3.025373
## 48: 0.34763379 3.1479440 0.330537773  45.110621
## 49:         NA        NA          NA         NA
## 50: 0.34763379 0.3176677 0.022167729   3.025373
## 51: 0.34763379 3.1479440 0.330537773  45.110621
## 52:         NA        NA          NA         NA
## 53: 1.00000000 0.7867773 0.078561110   7.821058
## 54: 1.00000000 1.2710078 0.127859942  12.728944
## 55:         NA        NA          NA         NA
## 56: 1.00000000 0.7867773 0.078561110   7.821058
## 57: 1.00000000 1.2710078 0.127859942  12.728944
## 58:         NA        NA          NA         NA
## 59: 1.00000000 0.7867773 0.078561110   7.821058
## 60: 1.00000000 1.2710078 0.127859942  12.728944
## 61:         NA        NA          NA         NA
## 62: 0.34763379 0.3176677 0.022167729   3.025373
## 63: 0.34763379 3.1479440 0.330537773  45.110621
## 64:         NA        NA          NA         NA
## 65: 0.34763379 0.3176677 0.022167729   3.025373
## 66: 0.34763379 3.1479440 0.330537773  45.110621
## 67:         NA        NA          NA         NA
## 68: 0.34763379 0.3176677 0.022167729   3.025373
## 69: 0.34763379 3.1479440 0.330537773  45.110621
## 70:         NA        NA          NA         NA
## 71: 0.05572755 0.1024623 0.001773299   1.250950
## 72: 0.05572755 9.7596867 0.799392236 563.920542
## 73:         NA        NA          NA         NA
## 74: 0.05572755 0.1024623 0.001773299   1.250950
## 75: 0.05572755 9.7596867 0.799392236 563.920542
## 76:         NA        NA          NA         NA
## 77: 1.00000000 0.7867773 0.078561110   7.821058
## 78: 1.00000000 1.2710078 0.127859942  12.728944
## 79:         NA        NA          NA         NA
## 80: 0.05572755 0.1024623 0.001773299   1.250950
## 81: 0.05572755 9.7596867 0.799392236 563.920542
## 82:         NA        NA          NA         NA
## 83: 0.64617426 1.9386158 0.204565986  27.339825
## 84: 0.64617426 0.5158320 0.036576679   4.888398
##        p_value        OR      OR_low    OR_high
## $pairwise_comparision
##     Hugo_Symbol  Feature_1      Feature_2 n_mutated_Feature1 n_mutated_Feature2
##          <char>     <char>         <char>             <char>             <char>
##  1:       MUC16 Responders Non-responders            8 of 10            4 of 12
##  2:        MYH8 Responders Non-responders            5 of 10            1 of 12
##  3:       PKHD1 Responders Non-responders            5 of 10            1 of 12
##  4:       EPHA6 Responders Non-responders            5 of 10            1 of 12
##  5:     MIR548N Responders Non-responders            8 of 10            5 of 12
##  6:       LRP1B Responders Non-responders            5 of 10            2 of 12
##  7:       USH2A Responders Non-responders            5 of 10            2 of 12
##  8:       HYDIN Responders Non-responders            5 of 10            2 of 12
##  9:        ZIM2 Responders Non-responders            5 of 10            2 of 12
## 10:       DNAH8 Responders Non-responders            4 of 10            2 of 12
## 11:      FAM83B Responders Non-responders            4 of 10            2 of 12
## 12:       WDFY4 Responders Non-responders            4 of 10            2 of 12
## 13:      COL4A5 Responders Non-responders            4 of 10            2 of 12
## 14:        FAT4 Responders Non-responders            4 of 10            2 of 12
## 15:      SHANK1 Responders Non-responders            2 of 10            4 of 12
## 16:       FSIP2 Responders Non-responders            4 of 10            3 of 12
## 17:       PTPRT Responders Non-responders            4 of 10            3 of 12
## 18:      SCN10A Responders Non-responders            4 of 10            3 of 12
## 19:       DNAH5 Responders Non-responders            5 of 10            4 of 12
## 20:         TTN Responders Non-responders            5 of 10            6 of 12
## 21:       CSMD1 Responders Non-responders            3 of 10            4 of 12
## 22:      ABCA13 Responders Non-responders            3 of 10            3 of 12
## 23:       DSCAM Responders Non-responders            3 of 10            3 of 12
## 24:      MYO15A Responders Non-responders            3 of 10            3 of 12
## 25:       DNAH6 Responders Non-responders            3 of 10            3 of 12
## 26:       CNTN5 Responders Non-responders            3 of 10            3 of 12
## 27:        BRAF Responders Non-responders            6 of 10            8 of 12
## 28:        PCLO Responders Non-responders            4 of 10            5 of 12
##     Hugo_Symbol  Feature_1      Feature_2 n_mutated_Feature1 n_mutated_Feature2
##            fdr
##          <num>
##  1: 0.04273126
##  2: 0.05572755
##  3: 0.05572755
##  4: 0.05572755
##  5: 0.09907121
##  6: 0.17182663
##  7: 0.17182663
##  8: 0.17182663
##  9: 0.17182663
## 10: 0.34763379
## 11: 0.34763379
## 12: 0.34763379
## 13: 0.34763379
## 14: 0.34763379
## 15: 0.64617426
## 16: 0.65170279
## 17: 0.65170279
## 18: 0.65170279
## 19: 0.66563467
## 20: 1.00000000
## 21: 1.00000000
## 22: 1.00000000
## 23: 1.00000000
## 24: 1.00000000
## 25: 1.00000000
## 26: 1.00000000
## 27: 1.00000000
## 28: 1.00000000
##            fdr
## 
## $groupwise_comparision
##     Hugo_Symbol         Group1 Group2 n_mutated_group1 n_mutated_group2
##          <char>         <char> <char>           <char>           <char>
##  1:       MUC16 Non-responders   Rest          4 of 12          8 of 10
##  2:       MUC16     Responders   Rest          8 of 10          4 of 12
##  3:        MYH8 Non-responders   Rest          1 of 12          5 of 10
##  4:        MYH8     Responders   Rest          5 of 10          1 of 12
##  5:       PKHD1 Non-responders   Rest          1 of 12          5 of 10
##  6:       PKHD1     Responders   Rest          5 of 10          1 of 12
##  7:       EPHA6 Non-responders   Rest          1 of 12          5 of 10
##  8:       EPHA6     Responders   Rest          5 of 10          1 of 12
##  9:     MIR548N Non-responders   Rest          5 of 12          8 of 10
## 10:     MIR548N     Responders   Rest          8 of 10          5 of 12
## 11:       LRP1B Non-responders   Rest          2 of 12          5 of 10
## 12:       LRP1B     Responders   Rest          5 of 10          2 of 12
## 13:       USH2A Non-responders   Rest          2 of 12          5 of 10
## 14:       USH2A     Responders   Rest          5 of 10          2 of 12
## 15:       HYDIN Non-responders   Rest          2 of 12          5 of 10
## 16:       HYDIN     Responders   Rest          5 of 10          2 of 12
## 17:        ZIM2 Non-responders   Rest          2 of 12          5 of 10
## 18:        ZIM2     Responders   Rest          5 of 10          2 of 12
## 19:       DNAH8 Non-responders   Rest          2 of 12          4 of 10
## 20:       DNAH8     Responders   Rest          4 of 10          2 of 12
## 21:      FAM83B Non-responders   Rest          2 of 12          4 of 10
## 22:      FAM83B     Responders   Rest          4 of 10          2 of 12
## 23:       WDFY4 Non-responders   Rest          2 of 12          4 of 10
## 24:       WDFY4     Responders   Rest          4 of 10          2 of 12
## 25:      COL4A5 Non-responders   Rest          2 of 12          4 of 10
## 26:      COL4A5     Responders   Rest          4 of 10          2 of 12
## 27:        FAT4 Non-responders   Rest          2 of 12          4 of 10
## 28:        FAT4     Responders   Rest          4 of 10          2 of 12
## 29:      SHANK1 Non-responders   Rest          4 of 12          2 of 10
## 30:      SHANK1     Responders   Rest          2 of 10          4 of 12
## 31:       FSIP2 Non-responders   Rest          3 of 12          4 of 10
## 32:       FSIP2     Responders   Rest          4 of 10          3 of 12
## 33:       PTPRT Non-responders   Rest          3 of 12          4 of 10
## 34:       PTPRT     Responders   Rest          4 of 10          3 of 12
## 35:      SCN10A Non-responders   Rest          3 of 12          4 of 10
## 36:      SCN10A     Responders   Rest          4 of 10          3 of 12
## 37:       DNAH5 Non-responders   Rest          4 of 12          5 of 10
## 38:       DNAH5     Responders   Rest          5 of 10          4 of 12
## 39:         TTN Non-responders   Rest          6 of 12          5 of 10
## 40:         TTN     Responders   Rest          5 of 10          6 of 12
## 41:       CSMD1 Non-responders   Rest          4 of 12          3 of 10
## 42:       CSMD1     Responders   Rest          3 of 10          4 of 12
## 43:      ABCA13 Non-responders   Rest          3 of 12          3 of 10
## 44:      ABCA13     Responders   Rest          3 of 10          3 of 12
## 45:       DSCAM Non-responders   Rest          3 of 12          3 of 10
## 46:       DSCAM     Responders   Rest          3 of 10          3 of 12
## 47:      MYO15A Non-responders   Rest          3 of 12          3 of 10
## 48:      MYO15A     Responders   Rest          3 of 10          3 of 12
## 49:       DNAH6 Non-responders   Rest          3 of 12          3 of 10
## 50:       DNAH6     Responders   Rest          3 of 10          3 of 12
## 51:       CNTN5 Non-responders   Rest          3 of 12          3 of 10
## 52:       CNTN5     Responders   Rest          3 of 10          3 of 12
## 53:        BRAF Non-responders   Rest          8 of 12          6 of 10
## 54:        BRAF     Responders   Rest          6 of 10          8 of 12
## 55:        PCLO Non-responders   Rest          5 of 12          4 of 10
## 56:        PCLO     Responders   Rest          4 of 10          5 of 12
##     Hugo_Symbol         Group1 Group2 n_mutated_group1 n_mutated_group2
##        p_value        OR      OR_low    OR_high       fdr
##          <num>     <num>       <num>      <num>     <num>
##  1: 0.04273126 0.1393973 0.009829588   1.164437 0.3900929
##  2: 0.04273126 7.1737384 0.858784223 101.733669 0.3900929
##  3: 0.05572755 0.1024623 0.001773299   1.250950 0.3900929
##  4: 0.05572755 9.7596867 0.799392236 563.920542 0.3900929
##  5: 0.05572755 0.1024623 0.001773299   1.250950 0.3900929
##  6: 0.05572755 9.7596867 0.799392236 563.920542 0.3900929
##  7: 0.05572755 0.1024623 0.001773299   1.250950 0.3900929
##  8: 0.05572755 9.7596867 0.799392236 563.920542 0.3900929
##  9: 0.09907121 0.1943170 0.014105470   1.601714 0.5345717
## 10: 0.09907121 5.1462289 0.624331001  70.894480 0.5345717
## 11: 0.17182663 0.2166050 0.015292506   1.914989 0.5345717
## 12: 0.17182663 4.6166977 0.522196276  65.391505 0.5345717
## 13: 0.17182663 0.2166050 0.015292506   1.914989 0.5345717
## 14: 0.17182663 4.6166977 0.522196276  65.391505 0.5345717
## 15: 0.17182663 0.2166050 0.015292506   1.914989 0.5345717
## 16: 0.17182663 4.6166977 0.522196276  65.391505 0.5345717
## 17: 0.17182663 0.2166050 0.015292506   1.914989 0.5345717
## 18: 0.17182663 4.6166977 0.522196276  65.391505 0.5345717
## 19: 0.34763379 0.3176677 0.022167729   3.025373 0.6952676
## 20: 0.34763379 3.1479440 0.330537773  45.110621 0.6952676
## 21: 0.34763379 0.3176677 0.022167729   3.025373 0.6952676
## 22: 0.34763379 3.1479440 0.330537773  45.110621 0.6952676
## 23: 0.34763379 0.3176677 0.022167729   3.025373 0.6952676
## 24: 0.34763379 3.1479440 0.330537773  45.110621 0.6952676
## 25: 0.34763379 0.3176677 0.022167729   3.025373 0.6952676
## 26: 0.34763379 3.1479440 0.330537773  45.110621 0.6952676
## 27: 0.34763379 0.3176677 0.022167729   3.025373 0.6952676
## 28: 0.34763379 3.1479440 0.330537773  45.110621 0.6952676
## 29: 0.64617426 1.9386158 0.204565986  27.339825 0.9809353
## 30: 0.64617426 0.5158320 0.036576679   4.888398 0.9809353
## 31: 0.65170279 0.5163825 0.054045583   4.332564 0.9809353
## 32: 0.65170279 1.9365490 0.230810220  18.502900 0.9809353
## 33: 0.65170279 0.5163825 0.054045583   4.332564 0.9809353
## 34: 0.65170279 1.9365490 0.230810220  18.502900 0.9809353
## 35: 0.65170279 0.5163825 0.054045583   4.332564 0.9809353
## 36: 0.65170279 1.9365490 0.230810220  18.502900 0.9809353
## 37: 0.66563467 0.5163899 0.064087475   3.791432 0.9809353
## 38: 0.66563467 1.9365213 0.263752588  15.603673 0.9809353
## 39: 1.00000000 1.0000000 0.138668627   7.211437 1.0000000
## 40: 1.00000000 1.0000000 0.138668627   7.211437 1.0000000
## 41: 1.00000000 1.1585362 0.137618146  10.854999 1.0000000
## 42: 1.00000000 0.8631582 0.092123452   7.266484 1.0000000
## 43: 1.00000000 0.7867773 0.078561110   7.821058 1.0000000
## 44: 1.00000000 1.2710078 0.127859942  12.728944 1.0000000
## 45: 1.00000000 0.7867773 0.078561110   7.821058 1.0000000
## 46: 1.00000000 1.2710078 0.127859942  12.728944 1.0000000
## 47: 1.00000000 0.7867773 0.078561110   7.821058 1.0000000
## 48: 1.00000000 1.2710078 0.127859942  12.728944 1.0000000
## 49: 1.00000000 0.7867773 0.078561110   7.821058 1.0000000
## 50: 1.00000000 1.2710078 0.127859942  12.728944 1.0000000
## 51: 1.00000000 0.7867773 0.078561110   7.821058 1.0000000
## 52: 1.00000000 1.2710078 0.127859942  12.728944 1.0000000
## 53: 1.00000000 1.3158848 0.166513699  10.588251 1.0000000
## 54: 1.00000000 0.7599449 0.094444307   6.005512 1.0000000
## 55: 1.00000000 1.0680540 0.144162138   8.236116 1.0000000
## 56: 1.00000000 0.9362822 0.121416450   6.936634 1.0000000
##        p_value        OR      OR_low    OR_high       fdr
## 
## $cf_sizes
##                cf     N
##            <char> <int>
## 1: Non-responders    12
## 2:     Responders    10
## 
## $clinicalFeature
## [1] "Patient_Response"
## Writes maf summary to an output file with basename mm909
write.mafSummary(maf = mm909, basename = file.path(results_fip_path, 'mm909'))

11.1.3 Count SNP, DNP, Missense, Nonsense, Splice, Nonstop

maf_df_annotated %>% 
  dplyr::filter(Variant_Type == "SNP") %>% 
  dplyr::count() %>% 
  dplyr::rename(SNP = n)
## # A tibble: 1 × 1
##     SNP
##   <int>
## 1 10489
maf_df_annotated %>% 
  dplyr::filter(Variant_Type == "DNP") %>% 
  dplyr::count() %>% 
  dplyr::rename(DNP = n)
## # A tibble: 1 × 1
##     DNP
##   <int>
## 1   304
maf_df_annotated %>% 
  dplyr::filter(Variant_Classification == "Missense_Mutation") %>% 
  dplyr::count() %>% 
  dplyr::rename(Missense_Mutation = n)
## # A tibble: 1 × 1
##   Missense_Mutation
##               <int>
## 1              6345
maf_df_annotated %>% 
  dplyr::filter(Variant_Classification == "Nonsense_Mutation") %>% 
  dplyr::count() %>% 
  dplyr::rename(Nonsense_Mutation = n)
## # A tibble: 1 × 1
##   Nonsense_Mutation
##               <int>
## 1               381
maf_df_annotated %>% 
  dplyr::filter(Variant_Classification == "Splice_Site") %>% 
  dplyr::count() %>% 
  dplyr::rename(Splice_Site = n)
## # A tibble: 1 × 1
##   Splice_Site
##         <int>
## 1         285
maf_df_annotated %>% 
  dplyr::filter(Variant_Classification == "Nonstop_Mutation") %>% 
  dplyr::count() %>% 
  dplyr::rename(Nonstop_Mutation = n)
## # A tibble: 1 × 1
##   Nonstop_Mutation
##              <int>
## 1                4

11.1.4 Visualization

# Fig3

# Define output path
plot_path1 <- file.path(figures_fip_path, "maf_summary.png")

# Open a PNG device
png(filename = plot_path1, width = 3000, height = 1600, res = 300)

# Generate the plot
plotmafSummary(maf = mm909, rmOutlier = TRUE, addStat = 'median', dashboard = TRUE, titvRaw = FALSE)

# Close the device
dev.off()
## quartz_off_screen 
##                 2
knitr::include_graphics(plot_path1)

# Get the summary of mutations per sample
sample_summary <- getSampleSummary(mm909)

# View the sample summary to understand the data structure
print(sample_summary)
##     Tumor_Sample_Barcode Missense_Mutation Nonsense_Mutation Nonstop_Mutation
##                   <fctr>             <int>             <int>            <int>
##  1:           MM909_22_1              1271                65                1
##  2:           MM909_03_1              1159                67                0
##  3:           MM909_26_1               828                47                0
##  4:           MM909_42_1               398                24                0
##  5:           MM909_43_1               349                27                0
##  6:           MM909_15_2               342                21                0
##  7:           MM909_46_1               287                22                0
##  8:           MM909_16_1               285                19                0
##  9:           MM909_17_1               237                 8                1
## 10:           MM909_25_1               168                12                0
## 11:           MM909_11_1               155                14                0
## 12:           MM909_31_1               150                12                0
## 13:           MM909_40_1               138                 9                1
## 14:           MM909_02_1               111                 5                0
## 15:           MM909_35_1               101                 3                0
## 16:           MM909_34_2                87                 9                0
## 17:           MM909_37_1                76                 5                0
## 18:           MM909_27_1                68                 2                1
## 19:           MM909_06_1                46                 4                0
## 20:           MM909_36_1                45                 4                0
## 21:           MM909_14_1                29                 2                0
## 22:           MM909_47_1                15                 0                0
##     Tumor_Sample_Barcode Missense_Mutation Nonsense_Mutation Nonstop_Mutation
##     Splice_Site total
##           <int> <num>
##  1:          52  1389
##  2:          59  1285
##  3:          28   903
##  4:          14   436
##  5:          16   392
##  6:          13   376
##  7:          10   319
##  8:          11   315
##  9:          19   265
## 10:           6   186
## 11:           9   178
## 12:          11   173
## 13:           8   156
## 14:           9   125
## 15:           3   107
## 16:           4   100
## 17:           2    83
## 18:           2    73
## 19:           2    52
## 20:           1    50
## 21:           4    35
## 22:           2    17
##     Splice_Site total
# Oncoplot for top ten mutated genes.

# Define output path
plot_path2 <- file.path(figures_fip_path, "maf_top50.png")

# Open a PNG device
png(filename = plot_path2, width = 3500, height = 4000, res = 300)

#Color coding for response
resp_colors = c("#009E73", "#D55E00")
names(resp_colors) = c("Responders", "Non-responders")
response_colors = list(Patient_Response = resp_colors)

#Color coding for sample id
sample_colors <- c(
  "#56B4E9", "#999999", "#8A2BE2", "#E69F00", "#D55E00", "#CC79A7", 
  "#009E73", "#F0E442", "#0072B2", "#FF69B4", "#FFD700", "#000000", 
  "#00CED1", "#4B0082", "#1E90FF", "#FF6347", "#32CD32", "#8B4513", 
  "#FF4500", "#B22222", "#FFDAB9", "#20B2AA"
)
names(sample_colors) = unique(maf_df_annotated$Sample_ID)
sample_id_colors = list(Sample_ID = sample_colors)

print(response_colors)
## $Patient_Response
##     Responders Non-responders 
##      "#009E73"      "#D55E00"
# Generate plot
oncoplot(maf = mm909, top = 50, drawColBar = FALSE, clinicalFeatures = c('Patient_Response'), sortByAnnotation = TRUE, annotationColor = response_colors, anno_height = 0.25, legend_height = 1)

# Close the device
dev.off()
## quartz_off_screen 
##                 2
knitr::include_graphics(plot_path2)

mm909.titv = titv(maf = mm909, plot = FALSE, useSyn = TRUE)
# Plot titv summary
plotTiTv(res = mm909.titv)

mm909.mutload = tcgaCompare(maf = mm909, cohortName = 'Example-mm909', logscale = TRUE, capture_size = 50)

11.2 LoF mutations

11.2.1 Load data

# Filter for LoF mutations
lof_vep_maf <- lof_vep_df_reduced %>% 
  separate(Location, into = c("Chromosome", "Position"), sep = ":", convert = TRUE) %>%
  separate(Position, into = c("Start_position", "End_position"), sep = "-", convert = TRUE) %>% 
  dplyr::rename(alt_allele = Allele)

# Rename
maf_df_annotated2 <- maf_df_annotated %>% 
  dplyr::rename(sample_id = Sample_ID)

# Filter maf_df_annotated based on matching rows in lof_vep_df_reduced
lof_maf_df <- maf_df_annotated2 %>%
  semi_join(lof_vep_maf, by = c("sample_id", "ensembl_id", "entrez_id", "Chromosome", "Start_position", "End_position", "alt_allele"))

# Load maf with clinical data
mm909 = read.maf(maf = lof_maf_df, clinicalData = clinical_resp_df)
## -Validating
## -Silent variants: 7 
## -Summarizing
## --Possible FLAGS among top ten genes:
##   MUC16
##   TTN
## -Processing clinical data
## -Finished in 0.773s elapsed (0.596s cpu)

11.2.2 Summaries

## Shows sample summry.
sample_sum <- getSampleSummary(mm909)
getSampleSummary(mm909)
##     Tumor_Sample_Barcode Missense_Mutation Nonsense_Mutation Splice_Site total
##                   <fctr>             <int>             <int>       <int> <num>
##  1:           MM909_22_1               840                 1          16   857
##  2:           MM909_03_1               769                 0          30   799
##  3:           MM909_26_1               564                 0           7   571
##  4:           MM909_42_1               268                 0           4   272
##  5:           MM909_15_2               243                 1           4   248
##  6:           MM909_43_1               240                 0           3   243
##  7:           MM909_16_1               190                 0           2   192
##  8:           MM909_46_1               178                 0           5   183
##  9:           MM909_17_1               162                 0           7   169
## 10:           MM909_25_1               120                 0           1   121
## 11:           MM909_11_1               104                 0           6   110
## 12:           MM909_31_1                97                 0           4   101
## 13:           MM909_40_1                88                 0           2    90
## 14:           MM909_02_1                73                 0           5    78
## 15:           MM909_35_1                72                 0           2    74
## 16:           MM909_34_2                62                 0           1    63
## 17:           MM909_37_1                52                 0           1    53
## 18:           MM909_27_1                41                 0           1    42
## 19:           MM909_36_1                33                 0           1    34
## 20:           MM909_06_1                30                 0           0    30
## 21:           MM909_14_1                13                 0           1    14
## 22:           MM909_47_1                 9                 0           1    10
##     Tumor_Sample_Barcode Missense_Mutation Nonsense_Mutation Splice_Site total
## Shows gene summary.
getGeneSummary(mm909)
##       Hugo_Symbol Missense_Mutation Nonsense_Mutation Splice_Site total
##            <char>             <int>             <int>       <int> <num>
##    1:        BRAF                15                 0           0    15
##    2:     MIR548N                17                 0           0    17
##    3:       MUC16                23                 0           0    23
##    4:         TTN                18                 0           0    18
##    5:        PCLO                10                 0           0    10
##   ---                                                                  
## 3196:       ZPLD1                 1                 0           0     1
## 3197:     ZSCAN18                 1                 0           0     1
## 3198:     ZSCAN31                 1                 0           0     1
## 3199:     ZSCAN5A                 1                 0           0     1
## 3200:      ZWILCH                 1                 0           0     1
##       MutatedSamples AlteredSamples
##                <int>          <int>
##    1:             13             13
##    2:             11             11
##    3:             10             10
##    4:              8              8
##    5:              7              7
##   ---                              
## 3196:              1              1
## 3197:              1              1
## 3198:              1              1
## 3199:              1              1
## 3200:              1              1
## Shows clinical data associated with samples
getClinicalData(mm909)
##     Sample_ID               Sample.Timepoint AJCC.Stage PFS.Time PFS.Event
##        <char>                         <char>     <char>   <char>    <char>
##  1:  MM909_02                    Before TILs        M1b     2.00         1
##  2:  MM909_03                    Before TILs        M1c     3.80         1
##  3:  MM909_06                    Before TILs        M1c     2.30         1
##  4:  MM909_11                    Before TILs        M1a    13.10         1
##  5:  MM909_14                    Before TILs        M1c     2.50         1
##  6:  MM909_15                    Before TILs        M1b    67.13         0
##  7:  MM909_16                    Before TILs        M1c     3.90         1
##  8:  MM909_17                    Before TILs        M1c    64.87         0
##  9:  MM909_22   After Ipilimumab/Before TILs        M1c    32.10         0
## 10:  MM909_25                    Before TILs        M1b     3.77         1
## 11:  MM909_26                    Before TILs        M1c    52.70         0
## 12:  MM909_27 Before Vemurafenib/Before TILs        M1c     2.00         1
## 13:  MM909_31                    Before TILs        M1c    11.30         1
## 14:  MM909_34                    Before TILs        M1c     2.83         1
## 15:  MM909_35 During Vemurafenib/Before TILs        M1c     3.13         1
## 16:  MM909_36 During Vemurafenib/Before TILs        M1c     8.23         1
## 17:  MM909_37                    Before TILs        M1c     3.03         1
## 18:  MM909_40                    Before TILs        M1c     3.73         1
## 19:  MM909_42                    Before TILs        M1c    42.30         0
## 20:  MM909_43                    Before TILs        M1c     1.93         1
## 21:  MM909_46                    Before TILs        M1c     5.83         1
## 22:  MM909_47                    Before TILs        M1c     3.27         1
##     Sample_ID               Sample.Timepoint AJCC.Stage PFS.Time PFS.Event
##     OS.Time OS.Event Type.of.Lesion Type.of.Primary RECIST Patient_Response
##      <char>   <char>         <char>          <char> <char>           <char>
##  1:     6.9        1             LN            skin     PD   Non-responders
##  2:    11.4        1             SC         unknown     SD   Non-responders
##  3:     4.6        1             LN            skin     PD   Non-responders
##  4:    71.5        0             LN            skin     CR       Responders
##  5:     3.2        1             LN         unknown     PD   Non-responders
##  6:    67.1        0             LN            skin     CR       Responders
##  7:    65.3        0             SC            skin     SD       Responders
##  8:    64.9        0             LN            skin     PR       Responders
##  9:    32.1        1           <NA>            skin     PR       Responders
## 10:     5.5        1             LN            skin     SD   Non-responders
## 11:    52.7        0             IM            skin     CR       Responders
## 12:     3.5        1             SC            skin     PD   Non-responders
## 13:    20.1        1             SC          mucosa     PR       Responders
## 14:     5.0        1             LN          mucosa     SD   Non-responders
## 15:    23.7        1             SC            skin     SD   Non-responders
## 16:    24.6        1             IA            skin     PR       Responders
## 17:    12.1        1             SC            skin     SD   Non-responders
## 18:    14.0        1             IA            skin     SD   Non-responders
## 19:    42.3        0             SC            skin     CR       Responders
## 20:    22.8        1             SC         unknown     PD   Non-responders
## 21:    24.8        1             LN            skin     SD       Responders
## 22:    18.9        1         pleura         unknown     SD   Non-responders
##     OS.Time OS.Event Type.of.Lesion Type.of.Primary RECIST Patient_Response
##     mut_load Tumor_Sample_Barcode
##       <char>               <char>
##  1:      199           MM909_02_1
##  2:     2036           MM909_03_1
##  3:       86           MM909_06_1
##  4:      277           MM909_11_1
##  5:       62           MM909_14_1
##  6:      581           MM909_15_2
##  7:      493           MM909_16_1
##  8:      366           MM909_17_1
##  9:     2200           MM909_22_1
## 10:      295           MM909_25_1
## 11:     1378           MM909_26_1
## 12:      110           MM909_27_1
## 13:      246           MM909_31_1
## 14:      157           MM909_34_2
## 15:      180           MM909_35_1
## 16:       85           MM909_36_1
## 17:      131           MM909_37_1
## 18:      214           MM909_40_1
## 19:      654           MM909_42_1
## 20:      601           MM909_43_1
## 21:      488           MM909_46_1
## 22:       23           MM909_47_1
##     mut_load Tumor_Sample_Barcode
## Shows all fields in MAF
getFields(mm909)
##  [1] "sample_id"              "ensembl_id"             "entrez_id"             
##  [4] "Hugo_Symbol"            "contig"                 "position"              
##  [7] "context"                "ref_allele"             "alt_allele"            
## [10] "tumor_name"             "normal_name"            "score"                 
## [13] "dbsnp_site"             "covered"                "power"                 
## [16] "tumor_power"            "normal_power"           "total_pairs"           
## [19] "improper_pairs"         "map_Q0_reads"           "t_lod_fstar"           
## [22] "tumor_f"                "contaminant_fraction"   "contaminant_lod"       
## [25] "t_ref_count"            "t_alt_count"            "t_ref_sum"             
## [28] "t_alt_sum"              "t_ref_max_mapq"         "t_alt_max_mapq"        
## [31] "t_ins_count"            "t_del_count"            "normal_best_gt"        
## [34] "init_n_lod"             "n_ref_count"            "n_alt_count"           
## [37] "n_ref_sum"              "n_alt_sum"              "judgement"             
## [40] "chrom23"                "Chromosome"             "Start_Position"        
## [43] "End_Position"           "Strand"                 "Tumor_Sample_Barcode"  
## [46] "Center"                 "NCBI_Build"             "Variant_Classification"
## [49] "Variant_Type"           "Reference_Allele"       "Tumor_Seq_Allele1"     
## [52] "Tumor_Seq_Allele2"      "cDNA_Change"            "Codon_Change"          
## [55] "Protein_Change"
## Shows clinical enrichment
clinicalEnrichment(mm909, "Patient_Response")
## 
## Non-responders     Responders 
##             12             10 
##     Hugo_Symbol  Feature_1      Feature_2 n_mutated_Feature1 n_mutated_Feature2
##          <char>     <char>         <char>             <char>             <char>
##  1:        BRAF Responders Non-responders            5 of 10            8 of 12
##  2:        BRAF       <NA>           <NA>               <NA>               <NA>
##  3:        BRAF       <NA>           <NA>               <NA>               <NA>
##  4:     MIR548N Responders Non-responders            7 of 10            4 of 12
##  5:     MIR548N       <NA>           <NA>               <NA>               <NA>
##  6:     MIR548N       <NA>           <NA>               <NA>               <NA>
##  7:       MUC16 Responders Non-responders            8 of 10            2 of 12
##  8:       MUC16       <NA>           <NA>               <NA>               <NA>
##  9:       MUC16       <NA>           <NA>               <NA>               <NA>
## 10:         TTN Responders Non-responders            5 of 10            3 of 12
## 11:         TTN       <NA>           <NA>               <NA>               <NA>
## 12:         TTN       <NA>           <NA>               <NA>               <NA>
## 13:        PCLO Responders Non-responders            3 of 10            4 of 12
## 14:        PCLO       <NA>           <NA>               <NA>               <NA>
## 15:        PCLO       <NA>           <NA>               <NA>               <NA>
## 16:      ABCA13 Responders Non-responders            3 of 10            3 of 12
## 17:      ABCA13       <NA>           <NA>               <NA>               <NA>
## 18:      ABCA13       <NA>           <NA>               <NA>               <NA>
## 19:       CSMD1 Responders Non-responders            3 of 10            3 of 12
## 20:       CSMD1       <NA>           <NA>               <NA>               <NA>
## 21:       CSMD1       <NA>           <NA>               <NA>               <NA>
## 22:        MYH8 Responders Non-responders            5 of 10            1 of 12
## 23:        MYH8       <NA>           <NA>               <NA>               <NA>
## 24:        MYH8       <NA>           <NA>               <NA>               <NA>
##     Hugo_Symbol  Feature_1      Feature_2 n_mutated_Feature1 n_mutated_Feature2
##             fdr Analysis         Group1 Group2 n_mutated_group1
##           <num>   <char>         <char> <char>           <char>
##  1: 0.665634675 Pairwise           <NA>   <NA>             <NA>
##  2:          NA    Group Non-responders   Rest          8 of 12
##  3:          NA    Group     Responders   Rest          5 of 10
##  4: 0.198380567 Pairwise           <NA>   <NA>             <NA>
##  5:          NA    Group Non-responders   Rest          4 of 12
##  6:          NA    Group     Responders   Rest          7 of 10
##  7: 0.008284285 Pairwise           <NA>   <NA>             <NA>
##  8:          NA    Group Non-responders   Rest          2 of 12
##  9:          NA    Group     Responders   Rest          8 of 10
## 10: 0.377708978 Pairwise           <NA>   <NA>             <NA>
## 11:          NA    Group Non-responders   Rest          3 of 12
## 12:          NA    Group     Responders   Rest          5 of 10
## 13: 1.000000000 Pairwise           <NA>   <NA>             <NA>
## 14:          NA    Group Non-responders   Rest          4 of 12
## 15:          NA    Group     Responders   Rest          3 of 10
## 16: 1.000000000 Pairwise           <NA>   <NA>             <NA>
## 17:          NA    Group Non-responders   Rest          3 of 12
## 18:          NA    Group     Responders   Rest          3 of 10
## 19: 1.000000000 Pairwise           <NA>   <NA>             <NA>
## 20:          NA    Group Non-responders   Rest          3 of 12
## 21:          NA    Group     Responders   Rest          3 of 10
## 22: 0.055727554 Pairwise           <NA>   <NA>             <NA>
## 23:          NA    Group Non-responders   Rest          1 of 12
## 24:          NA    Group     Responders   Rest          5 of 10
##             fdr Analysis         Group1 Group2 n_mutated_group1
##     n_mutated_group2     p_value          OR      OR_low     OR_high
##               <char>       <num>       <num>       <num>       <num>
##  1:             <NA>          NA          NA          NA          NA
##  2:          5 of 10 0.665634675  1.93652133 0.263752588  15.6036729
##  3:          8 of 12 0.665634675  0.51638987 0.064087475   3.7914320
##  4:             <NA>          NA          NA          NA          NA
##  5:          7 of 10 0.198380567  0.23140461 0.023782661   1.7297317
##  6:          4 of 12 0.198380567  4.32143517 0.578124339  42.0474391
##  7:             <NA>          NA          NA          NA          NA
##  8:          8 of 10 0.008284285  0.06077883 0.003443304   0.5897034
##  9:          2 of 12 0.008284285 16.45309815 1.695767733 290.4187413
## 10:             <NA>          NA          NA          NA          NA
## 11:          5 of 10 0.377708978  0.35137037 0.036968351   2.7360577
## 12:          3 of 12 0.377708978  2.84599982 0.365489374  27.0501651
## 13:             <NA>          NA          NA          NA          NA
## 14:          3 of 10 1.000000000  1.15853624 0.137618146  10.8549992
## 15:          4 of 12 1.000000000  0.86315816 0.092123452   7.2664836
## 16:             <NA>          NA          NA          NA          NA
## 17:          3 of 10 1.000000000  0.78677725 0.078561110   7.8210578
## 18:          3 of 12 1.000000000  1.27100777 0.127859942  12.7289443
## 19:             <NA>          NA          NA          NA          NA
## 20:          3 of 10 1.000000000  0.78677725 0.078561110   7.8210578
## 21:          3 of 12 1.000000000  1.27100777 0.127859942  12.7289443
## 22:             <NA>          NA          NA          NA          NA
## 23:          5 of 10 0.055727554  0.10246231 0.001773299   1.2509504
## 24:          1 of 12 0.055727554  9.75968674 0.799392236 563.9205419
##     n_mutated_group2     p_value          OR      OR_low     OR_high
## $pairwise_comparision
##    Hugo_Symbol  Feature_1      Feature_2 n_mutated_Feature1 n_mutated_Feature2
##         <char>     <char>         <char>             <char>             <char>
## 1:       MUC16 Responders Non-responders            8 of 10            2 of 12
## 2:        MYH8 Responders Non-responders            5 of 10            1 of 12
## 3:     MIR548N Responders Non-responders            7 of 10            4 of 12
## 4:         TTN Responders Non-responders            5 of 10            3 of 12
## 5:        BRAF Responders Non-responders            5 of 10            8 of 12
## 6:        PCLO Responders Non-responders            3 of 10            4 of 12
## 7:      ABCA13 Responders Non-responders            3 of 10            3 of 12
## 8:       CSMD1 Responders Non-responders            3 of 10            3 of 12
##            fdr
##          <num>
## 1: 0.008284285
## 2: 0.055727554
## 3: 0.198380567
## 4: 0.377708978
## 5: 0.665634675
## 6: 1.000000000
## 7: 1.000000000
## 8: 1.000000000
## 
## $groupwise_comparision
##     Hugo_Symbol         Group1 Group2 n_mutated_group1 n_mutated_group2
##          <char>         <char> <char>           <char>           <char>
##  1:       MUC16 Non-responders   Rest          2 of 12          8 of 10
##  2:       MUC16     Responders   Rest          8 of 10          2 of 12
##  3:        MYH8 Non-responders   Rest          1 of 12          5 of 10
##  4:        MYH8     Responders   Rest          5 of 10          1 of 12
##  5:     MIR548N Non-responders   Rest          4 of 12          7 of 10
##  6:     MIR548N     Responders   Rest          7 of 10          4 of 12
##  7:         TTN Non-responders   Rest          3 of 12          5 of 10
##  8:         TTN     Responders   Rest          5 of 10          3 of 12
##  9:        BRAF Non-responders   Rest          8 of 12          5 of 10
## 10:        BRAF     Responders   Rest          5 of 10          8 of 12
## 11:        PCLO Non-responders   Rest          4 of 12          3 of 10
## 12:        PCLO     Responders   Rest          3 of 10          4 of 12
## 13:      ABCA13 Non-responders   Rest          3 of 12          3 of 10
## 14:      ABCA13     Responders   Rest          3 of 10          3 of 12
## 15:       CSMD1 Non-responders   Rest          3 of 12          3 of 10
## 16:       CSMD1     Responders   Rest          3 of 10          3 of 12
##         p_value          OR      OR_low     OR_high        fdr
##           <num>       <num>       <num>       <num>      <num>
##  1: 0.008284285  0.06077883 0.003443304   0.5897034 0.06627428
##  2: 0.008284285 16.45309815 1.695767733 290.4187413 0.06627428
##  3: 0.055727554  0.10246231 0.001773299   1.2509504 0.22291022
##  4: 0.055727554  9.75968674 0.799392236 563.9205419 0.22291022
##  5: 0.198380567  0.23140461 0.023782661   1.7297317 0.52901484
##  6: 0.198380567  4.32143517 0.578124339  42.0474391 0.52901484
##  7: 0.377708978  0.35137037 0.036968351   2.7360577 0.75541796
##  8: 0.377708978  2.84599982 0.365489374  27.0501651 0.75541796
##  9: 0.665634675  1.93652133 0.263752588  15.6036729 1.00000000
## 10: 0.665634675  0.51638987 0.064087475   3.7914320 1.00000000
## 11: 1.000000000  1.15853624 0.137618146  10.8549992 1.00000000
## 12: 1.000000000  0.86315816 0.092123452   7.2664836 1.00000000
## 13: 1.000000000  0.78677725 0.078561110   7.8210578 1.00000000
## 14: 1.000000000  1.27100777 0.127859942  12.7289443 1.00000000
## 15: 1.000000000  0.78677725 0.078561110   7.8210578 1.00000000
## 16: 1.000000000  1.27100777 0.127859942  12.7289443 1.00000000
## 
## $cf_sizes
##                cf     N
##            <char> <int>
## 1: Non-responders    12
## 2:     Responders    10
## 
## $clinicalFeature
## [1] "Patient_Response"
## Writes maf summary to an output file with basename mm909
write.mafSummary(maf = mm909, basename = file.path(results_fip_path, 'mm909_lof'))

11.2.3 Visualization

# Define output path
plot_path1 <- file.path(figures_fip_path, "maf_lof_summary.png")

# Open a PNG device
png(filename = plot_path1, width = 3000, height = 1600, res = 300)

# Generate the plot
plotmafSummary(maf = mm909, rmOutlier = TRUE, addStat = 'median', dashboard = TRUE, titvRaw = FALSE)

# Close the device
dev.off()
## quartz_off_screen 
##                 2
knitr::include_graphics(plot_path1)

# Get the summary of mutations per sample
sample_summary <- getSampleSummary(mm909)

# View the sample summary to understand the data structure
print(sample_summary)
##     Tumor_Sample_Barcode Missense_Mutation Nonsense_Mutation Splice_Site total
##                   <fctr>             <int>             <int>       <int> <num>
##  1:           MM909_22_1               840                 1          16   857
##  2:           MM909_03_1               769                 0          30   799
##  3:           MM909_26_1               564                 0           7   571
##  4:           MM909_42_1               268                 0           4   272
##  5:           MM909_15_2               243                 1           4   248
##  6:           MM909_43_1               240                 0           3   243
##  7:           MM909_16_1               190                 0           2   192
##  8:           MM909_46_1               178                 0           5   183
##  9:           MM909_17_1               162                 0           7   169
## 10:           MM909_25_1               120                 0           1   121
## 11:           MM909_11_1               104                 0           6   110
## 12:           MM909_31_1                97                 0           4   101
## 13:           MM909_40_1                88                 0           2    90
## 14:           MM909_02_1                73                 0           5    78
## 15:           MM909_35_1                72                 0           2    74
## 16:           MM909_34_2                62                 0           1    63
## 17:           MM909_37_1                52                 0           1    53
## 18:           MM909_27_1                41                 0           1    42
## 19:           MM909_36_1                33                 0           1    34
## 20:           MM909_06_1                30                 0           0    30
## 21:           MM909_14_1                13                 0           1    14
## 22:           MM909_47_1                 9                 0           1    10
##     Tumor_Sample_Barcode Missense_Mutation Nonsense_Mutation Splice_Site total
# Fig6

# Oncoplot for top fifty mutated genes.

# Define output path
plot_path2 <- file.path(figures_fip_path, "maf_lof_top50.png")

# Open a PNG device
png(filename = plot_path2, width = 3500, height = 4000, res = 300)

#Color coding for response
resp_colors = c("#009E73", "#D55E00")
names(resp_colors) = c("Responders", "Non-responders")
response_colors = list(Patient_Response = resp_colors)

#Color coding for sample id
sample_colors <- c(
  "#56B4E9", "#999999", "#8A2BE2", "#E69F00", "#D55E00", "#CC79A7", 
  "#009E73", "#F0E442", "#0072B2", "#FF69B4", "#FFD700", "#000000", 
  "#00CED1", "#4B0082", "#1E90FF", "#FF6347", "#32CD32", "#8B4513", 
  "#FF4500", "#B22222", "#FFDAB9", "#20B2AA"
)
names(sample_colors) = unique(maf_df_annotated$Sample_ID)
sample_id_colors = list(Sample_ID = sample_colors)

print(response_colors)
## $Patient_Response
##     Responders Non-responders 
##      "#009E73"      "#D55E00"
# Generate plot
oncoplot(maf = mm909, top = 50, drawColBar = FALSE, clinicalFeatures = 'Patient_Response', sortByAnnotation = TRUE, annotationColor = response_colors, anno_height = 0.25, legend_height = 1, showTitle = FALSE, drawBox = TRUE, legendFontSize = 1.7, annotationFontSize = 1.7)

# Close the device
dev.off()
## quartz_off_screen 
##                 2
knitr::include_graphics(plot_path2)

mm909.titv = titv(maf = mm909, plot = FALSE, useSyn = TRUE)
# Plot titv summary
plotTiTv(res = mm909.titv)

mm909.mutload = tcgaCompare(maf = mm909, cohortName = 'Example-mm909', logscale = TRUE, capture_size = 50)

12 Explore shared LoF mutated genes

# Fig4

resp_df <- clinical_resp_df %>% 
  dplyr::select(Sample_ID, Patient_Response) %>% 
  dplyr::rename(sample_id = Sample_ID,
                patient_response = Patient_Response)

maf_df_resp <- lof_maf_df %>% 
  dplyr::left_join(resp_df, by="sample_id")

# Get genes for each response group
responder_genes <- maf_df_resp %>%
  dplyr::filter(patient_response == "Responders") %>%
  pull(hugo_symbol) %>%
  unique()

non_responder_genes <- maf_df_resp %>%
  dplyr::filter(patient_response == "Non-responders") %>%
  pull(hugo_symbol) %>%
  unique()

# Identify unique and shared genes
shared_genes <- intersect(responder_genes, non_responder_genes)
unique_responder_genes <- setdiff(responder_genes, shared_genes)
unique_non_responder_genes <- setdiff(non_responder_genes, shared_genes)

# Define the lists for the Venn diagram
gene_lists <- list(
  Responder = responder_genes,
  Non_responder = non_responder_genes
)

# Set up PNG device to save the plot
venn_path <- file.path(figures_fip_path, "venn_diagram_shared_genes_lof.png")
png(filename = venn_path, width = 1000, height = 700, res = 300)

# Generate Venn diagram
venn.plot <- draw.pairwise.venn(
  area1 = length(responder_genes),
  area2 = length(non_responder_genes),
  cross.area = length(shared_genes),
  category = c("Responders", "Non-responders"),
  fill = c("#009E73", "#D55E00"),
  cex = 1,        # Adjust font size of numbers
  cat.cex = 1,  # Adjust category label font size
  cat.col = c("black", "black"),
  cat.pos = 0,         # Positions for category names (0 degrees, on top)
  cat.dist = 0.07,     # Increase this if labels overlap with the circles
  euler.d = TRUE,      # Force circles to be more circular
  lwd = 2,      # Line width
  filename = NULL
)

# Display the plot
grid.newpage()
grid.draw(venn.plot)

# Save the plot
dev.off()
## quartz_off_screen 
##                 2
knitr::include_graphics(venn_path)

13 Session Info

sessionInfo()
## R version 4.3.2 (2023-10-31)
## Platform: x86_64-apple-darwin20 (64-bit)
## Running under: macOS Monterey 12.7.4
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib 
## LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## time zone: Europe/Copenhagen
## tzcode source: internal
## 
## attached base packages:
## [1] stats4    grid      stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] ComplexHeatmap_2.18.0       GO.db_3.18.0               
##  [3] mygene_1.38.0               ggupset_0.3.0              
##  [5] clusterProfiler_4.10.1      limma_3.58.1               
##  [7] fgsea_1.28.0                EnsDb.Hsapiens.v86_2.99.0  
##  [9] EnsDb.Hsapiens.v75_2.99.0   ensembldb_2.26.0           
## [11] AnnotationFilter_1.26.0     GenomicFeatures_1.54.4     
## [13] GSEABase_1.64.0             graph_1.80.0               
## [15] annotate_1.80.0             XML_3.99-0.16.1            
## [17] AnnotationDbi_1.64.1        maftools_2.18.0            
## [19] biomaRt_2.58.2              VariantAnnotation_1.48.1   
## [21] Rsamtools_2.18.0            Biostrings_2.70.3          
## [23] XVector_0.42.0              SummarizedExperiment_1.32.0
## [25] Biobase_2.62.0              GenomicRanges_1.54.1       
## [27] GenomeInfoDb_1.38.8         IRanges_2.36.0             
## [29] S4Vectors_0.40.2            MatrixGenerics_1.14.0      
## [31] matrixStats_1.3.0           BiocGenerics_0.48.1        
## [33] magrittr_2.0.3              dendextend_1.17.1          
## [35] corrplot_0.92               broom_1.0.5                
## [37] ggrepel_0.9.5               ggplotify_0.1.2            
## [39] pheatmap_1.0.12             cowplot_1.1.3              
## [41] ggnewscale_0.4.10           reshape2_1.4.4             
## [43] ggdendro_0.2.0              ggpubr_0.6.0               
## [45] patchwork_1.2.0             gridtext_0.1.5             
## [47] circlize_0.4.16             VennDiagram_1.7.3          
## [49] futile.logger_1.4.3         HGNChelper_0.8.1           
## [51] msigdbr_7.5.1               jsonlite_1.8.8             
## [53] httr_1.4.7                  DT_0.33                    
## [55] knitr_1.45                  lubridate_1.9.3            
## [57] forcats_1.0.0               stringr_1.5.1              
## [59] dplyr_1.1.4                 purrr_1.0.2                
## [61] readr_2.1.5                 tidyr_1.3.1                
## [63] tibble_3.2.1                ggplot2_3.5.1              
## [65] tidyverse_2.0.0             readxl_1.4.3               
## [67] rprojroot_2.0.4            
## 
## loaded via a namespace (and not attached):
##   [1] fs_1.6.4                 ProtGenerics_1.34.0      bitops_1.0-7            
##   [4] enrichplot_1.22.0        doParallel_1.0.17        HDO.db_0.99.1           
##   [7] RColorBrewer_1.1-3       tools_4.3.2              backports_1.4.1         
##  [10] utf8_1.2.4               R6_2.5.1                 lazyeval_0.2.2          
##  [13] GetoptLong_1.0.5         withr_3.0.0              prettyunits_1.2.0       
##  [16] gridExtra_2.3            textshaping_0.3.7        cli_3.6.2               
##  [19] formatR_1.14             scatterpie_0.2.2         labeling_0.4.3          
##  [22] sass_0.4.9               systemfonts_1.1.0        yulab.utils_0.1.4       
##  [25] gson_0.1.0               foreign_0.8-86           R.utils_2.12.3          
##  [28] DOSE_3.28.2              BSgenome_1.70.2          rstudioapi_0.16.0       
##  [31] RSQLite_2.3.6            generics_0.1.3           gridGraphics_0.5-1      
##  [34] shape_1.4.6.1            BiocIO_1.12.0            crosstalk_1.2.1         
##  [37] car_3.1-2                Matrix_1.6-5             fansi_1.0.6             
##  [40] abind_1.4-5              R.methodsS3_1.8.2        lifecycle_1.0.4         
##  [43] yaml_2.3.8               carData_3.0-5            qvalue_2.34.0           
##  [46] SparseArray_1.2.4        BiocFileCache_2.10.2     blob_1.2.4              
##  [49] crayon_1.5.2             lattice_0.22-6           KEGGREST_1.42.0         
##  [52] pillar_1.9.0             rjson_0.2.21             codetools_0.2-20        
##  [55] fastmatch_1.1-4          glue_1.7.0               ggfun_0.1.4             
##  [58] data.table_1.15.4        vctrs_0.6.5              png_0.1-8               
##  [61] treeio_1.26.0            cellranger_1.1.0         gtable_0.3.5            
##  [64] gsubfn_0.7               cachem_1.0.8             xfun_0.44               
##  [67] S4Arrays_1.2.1           tidygraph_1.3.1          survival_3.6-4          
##  [70] iterators_1.0.14         statmod_1.5.0            nlme_3.1-164            
##  [73] ggtree_3.10.1            bit64_4.0.5              progress_1.2.3          
##  [76] filelock_1.0.3           bslib_0.7.0              rpart_4.1.23            
##  [79] colorspace_2.1-0         DBI_1.2.2                Hmisc_5.1-2             
##  [82] nnet_7.3-19              DNAcopy_1.76.0           tidyselect_1.2.1        
##  [85] chron_2.3-61             bit_4.0.5                compiler_4.3.2          
##  [88] curl_5.2.1               htmlTable_2.4.2          xml2_1.3.6              
##  [91] DelayedArray_0.28.0      shadowtext_0.1.3         rtracklayer_1.62.0      
##  [94] checkmate_2.3.1          scales_1.3.0             rappdirs_0.3.3          
##  [97] digest_0.6.35            rmarkdown_2.26           htmltools_0.5.8.1       
## [100] pkgconfig_2.0.3          base64enc_0.1-3          highr_0.10              
## [103] dbplyr_2.5.0             fastmap_1.2.0            rlang_1.1.3             
## [106] GlobalOptions_0.1.2      htmlwidgets_1.6.4        farver_2.1.2            
## [109] jquerylib_0.1.4          BiocParallel_1.36.0      R.oo_1.26.0             
## [112] GOSemSim_2.28.1          RCurl_1.98-1.14          Formula_1.2-5           
## [115] GenomeInfoDbData_1.2.11  munsell_0.5.1            Rcpp_1.0.12             
## [118] proto_1.0.0              ape_5.8                  babelgene_22.9          
## [121] viridis_0.6.5            sqldf_0.4-11             stringi_1.8.4           
## [124] ggraph_2.2.1             zlibbioc_1.48.2          MASS_7.3-60.0.1         
## [127] org.Hs.eg.db_3.18.0      plyr_1.8.9               parallel_4.3.2          
## [130] graphlayouts_1.1.1       splines_4.3.2            hms_1.1.3               
## [133] igraph_2.0.3             ggsignif_0.6.4           futile.options_1.0.1    
## [136] evaluate_0.23            lambda.r_1.2.4           BiocManager_1.30.23     
## [139] tzdb_0.4.0               foreach_1.5.2            tweenr_2.0.3            
## [142] polyclip_1.10-6          clue_0.3-65              ggforce_0.4.2           
## [145] xtable_1.8-4             restfulr_0.0.15          tidytree_0.4.6          
## [148] rstatix_0.7.2            ragg_1.3.2               viridisLite_0.4.2       
## [151] aplot_0.2.2              memoise_2.0.1            GenomicAlignments_1.38.2
## [154] cluster_2.1.6            timechange_0.3.0